Code example for JLabel

Methods: getPreferredSizesetPreferredSize

0
	public int getLabelWidth() { 
		return this.labelComponent.getPreferredSize().width;
	} 
	 
	public void setLabelWidth( int width ) {
		Dimension rect = this.labelComponent.getPreferredSize();
		//int diff  =  width - rect.width; 
		rect.width = width;
		this.labelComponent.setPreferredSize(rect);
//		if (this.inputTextField != null) { 
//			this.inputTextField.getBounds(rect); 
//			rect.x += diff; 
//			rect.width -= diff; 
//			this.inputTextField.setBounds(rect); 
//		} else if (this.inputComboBox != null) { 
//			this.inputComboBox.getBounds(rect); 
//			rect.x += diff; 
//			rect.width -= diff; 
//			this.inputComboBox.setBounds(rect);			 
//		}