Code example for JLabel

Methods: getPreferredSize

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);