Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libCq CMS for java.old / src / org / cresques / ui / raster / AndOrSelectorPanel.java @ 4578

History | View | Annotate | Download (2.44 KB)

1 4377 nacho
package org.cresques.ui.raster;
2
3
import java.awt.FlowLayout;
4
import java.awt.GridBagConstraints;
5
import java.awt.GridBagLayout;
6
7
import javax.swing.ButtonGroup;
8
import javax.swing.JPanel;
9
import javax.swing.JRadioButton;
10
11
public class AndOrSelectorPanel extends JPanel {
12
13
        private JPanel pBorder = null;
14
        private JRadioButton rbAnd = null;
15
        private JRadioButton rbOr = null;
16
        private ButtonGroup         group = null;
17
        /**
18
         * This is the default constructor
19
         */
20
        public AndOrSelectorPanel() {
21
                super();
22
                initialize();
23
        }
24
25
        /**
26
         * This method initializes this
27
         *
28
         * @return void
29
         */
30
        private void initialize() {
31
                FlowLayout flowLayout = new FlowLayout();
32
                flowLayout.setHgap(0);
33
                flowLayout.setVgap(0);
34
                this.setLayout(flowLayout);
35
                this.setSize(56, 50);
36
                this.setPreferredSize(new java.awt.Dimension(52,50));
37
                this.add(getJPanel(), null);
38
                this.getRbAnd().setSelected(true);
39
                group = new ButtonGroup();
40
                group.add(this.getRbAnd());
41
                group.add(this.getRbOr());
42
        }
43
44
        /**
45
         * This method initializes jPanel
46
         *
47
         * @return javax.swing.JPanel
48
         */
49
        private JPanel getJPanel() {
50
                if (pBorder == null) {
51
                        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
52
                        gridBagConstraints1.gridx = 0;
53
                        gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
54
                        gridBagConstraints1.gridy = 0;
55
                        GridBagConstraints gridBagConstraints = new GridBagConstraints();
56
                        gridBagConstraints.gridx = 0;
57
                        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
58
                        gridBagConstraints.gridy = 1;
59
                        pBorder = new JPanel();
60
                        pBorder.setLayout(new GridBagLayout());
61
                        pBorder.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
62
                        pBorder.add(getRbAnd(), gridBagConstraints1);
63
                        pBorder.add(getRbOr(), gridBagConstraints);
64
                }
65
                return pBorder;
66
        }
67
68
        /**
69
         * This method initializes jRadioButton
70
         *
71
         * @return javax.swing.JRadioButton
72
         */
73
        public JRadioButton getRbAnd() {
74
                if (rbAnd == null) {
75
                        rbAnd = new JRadioButton();
76
                        rbAnd.setText("And");
77
                }
78
                return rbAnd;
79
        }
80
81
        /**
82
         * This method initializes jRadioButton1
83
         *
84
         * @return javax.swing.JRadioButton
85
         */
86
        public JRadioButton getRbOr() {
87
                if (rbOr == null) {
88
                        rbOr = new JRadioButton();
89
                        rbOr.setText("Or");
90
                }
91
                return rbOr;
92
        }
93
94
        /**
95
         * Activa o desactiva el control
96
         * @param enable True activa el control y false lo desactiva
97
         */
98
        public void setControlEnabled(boolean enabled){
99
                this.getRbAnd().setEnabled(enabled);
100
                this.getRbOr().setEnabled(enabled);
101
        }
102
103
}