Revision 12180 trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/checkslidertext/CheckSliderTextContainer.java

View differences:

CheckSliderTextContainer.java
16 16
 * along with this program; if not, write to the Free Software
17 17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18 18
 */
19

  
20 19
package org.gvsig.gui.beans.checkslidertext;
21 20

  
22 21
import java.awt.BorderLayout;
......
31 30
import javax.swing.JPanel;
32 31

  
33 32
import org.gvsig.gui.beans.slidertext.SliderTextContainer;
34

  
35 33
/**
36 34
 * A?ade un check al componente Slider ajustando el tama?o del componente
37 35
 * a la longitud del check. Al redimensionar el componente varia el tama?o
38 36
 * del slider
37
 * 
39 38
 * @author Nacho Brodin(nachobrodin@gmail.com) 
40
 *
41 39
 */
42 40
public class CheckSliderTextContainer extends SliderTextContainer implements ActionListener{
43
	final private static long 	serialVersionUID = 0;
44
	public JCheckBox check = null;
45
	private JPanel pLabel = null;
46
	private String	text = null;
41
	private static final long serialVersionUID = -542842897847364459L;
42
	public JCheckBox          check            = null;
43
	private JPanel            pLabel           = null;
44
	private String            text             = null;
47 45

  
48 46
	/**
49 47
	 * Constructor	
......
76 74
	private JPanel getPCheck(boolean up) {
77 75
		if (pLabel == null) {
78 76
			pLabel = new JPanel();
79
			if(!up){
77
			if (!up) {
80 78
				GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
81 79
				gridBagConstraints1.insets = new java.awt.Insets(0, 10, 13, 0);
82 80
				pLabel.setLayout(new GridBagLayout());
83 81
				pLabel.add(getCheck(), gridBagConstraints1);
84
			}else{
82
			} else {
85 83
				FlowLayout fl = new FlowLayout();
86 84
				fl.setAlignment(FlowLayout.LEFT);
87 85
				pLabel.setLayout(fl);
......
95 93
	 * This method initializes JLabel
96 94
	 * @return
97 95
	 */
98
	public JCheckBox getCheck(){
96
	public JCheckBox getCheck() {
99 97
		if(check == null)
100 98
			check = new JCheckBox(text);
101 99
		return check;
......
105 103
	 * Activa o desactiva el control del panel
106 104
	 * @param active
107 105
	 */
108
	public void setControlEnabled(boolean active){
106
	public void setControlEnabled(boolean active) {
109 107
		getCheck().setSelected(active);
110 108
		super.setControlEnabled(active);
111 109
	}
112 110

  
111
	/*
112
	 * (non-Javadoc)
113
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
114
	 */
113 115
	public void actionPerformed(ActionEvent e) {
114 116
		if (e.getSource() == check) {
115 117
			setControlEnabled(check.isSelected());
116
			listener.stateChanged(null);
118
			callChangeValue();
117 119
		}
118 120
	}
119
}
121
}

Also available in: Unified diff