Revision 2165 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/DefaultColorChooserController.java

View differences:

DefaultColorChooserController.java
9 9
import javax.swing.JButton;
10 10
import javax.swing.JColorChooser;
11 11
import javax.swing.JSlider;
12
import javax.swing.JTextField;
13 12
import javax.swing.SwingUtilities;
14 13
import javax.swing.event.ChangeEvent;
15 14
import javax.swing.event.ChangeListener;
15
import javax.swing.text.JTextComponent;
16 16

  
17 17
import org.gvsig.tools.ToolsLocator;
18 18
import org.gvsig.tools.i18n.I18nManager;
......
22 22

  
23 23
public class DefaultColorChooserController implements ColorChooserController {
24 24

  
25
    private final JTextField txtLabel;
25
    private final JTextComponent txtLabel;
26 26
    private final JButton btnShowDialog;
27 27
    private final JSlider sldAlpha;
28 28
    private Color color;
29 29
    private boolean allowNull;
30 30
    private ChangeListener changeListener;
31 31

  
32
    public DefaultColorChooserController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull) {
32
    public DefaultColorChooserController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull) {
33 33
        this.txtLabel = txtLabel;
34 34
        this.btnShowDialog = btnShowDialog;
35 35
        this.sldAlpha = sldAlpha;
......
42 42
        for( ChangeListener l : sldAlpha.getChangeListeners()) {
43 43
            sldAlpha.removeChangeListener(l);
44 44
        }
45
        this.btnShowDialog.addActionListener(new ActionListener() {
46
            @Override
47
            public void actionPerformed(ActionEvent e) {
48
                doShowDialog();
49
            }
45
        this.btnShowDialog.addActionListener((ActionEvent e) -> {
46
          doShowDialog();
50 47
        });
51 48
        if( this.sldAlpha != null ) {
52 49
            this.sldAlpha.setMinimum(0);
53 50
            this.sldAlpha.setMaximum(255);
54
            this.sldAlpha.addChangeListener(new ChangeListener() {
55
                @Override
56
                public void stateChanged(ChangeEvent e) {
57
                    doAlphaChanged();
58
                }
51
            this.sldAlpha.addChangeListener((ChangeEvent e) -> {
52
              doAlphaChanged();
59 53
            });
60 54
        }
61 55
        Font font = this.txtLabel.getFont();
......
72 66
        }
73 67
    }
74 68

  
75
    public DefaultColorChooserController(JTextField txtLabel, JButton btnShowDialog) {
69
    public DefaultColorChooserController(JTextComponent txtLabel, JButton btnShowDialog) {
76 70
        this(txtLabel, btnShowDialog, null, false);
77 71
    }
78 72

  
79
    public DefaultColorChooserController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha) {
73
    public DefaultColorChooserController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha) {
80 74
        this(txtLabel, btnShowDialog, sldAlpha, false);
81 75
    }
82 76

  

Also available in: Unified diff