root / tags / v1_0_2_Build_916 / libraries / libCq CMS for java.old / src / org / cresques / ui / raster / AndOrSelectorPanel.java @ 12327
History | View | Annotate | Download (2.61 KB)
1 |
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(60, 60); |
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.setPreferredSize(new java.awt.Dimension(60,60)); |
63 |
pBorder.add(getRbAnd(), gridBagConstraints1); |
64 |
pBorder.add(getRbOr(), gridBagConstraints); |
65 |
} |
66 |
return pBorder;
|
67 |
} |
68 |
|
69 |
/**
|
70 |
* This method initializes jRadioButton
|
71 |
*
|
72 |
* @return javax.swing.JRadioButton
|
73 |
*/
|
74 |
public JRadioButton getRbAnd() { |
75 |
if (rbAnd == null) { |
76 |
rbAnd = new JRadioButton(); |
77 |
rbAnd.setText("And");
|
78 |
rbAnd.setPreferredSize(new java.awt.Dimension(60,25)); |
79 |
} |
80 |
return rbAnd;
|
81 |
} |
82 |
|
83 |
/**
|
84 |
* This method initializes jRadioButton1
|
85 |
*
|
86 |
* @return javax.swing.JRadioButton
|
87 |
*/
|
88 |
public JRadioButton getRbOr() { |
89 |
if (rbOr == null) { |
90 |
rbOr = new JRadioButton(); |
91 |
rbOr.setText("Or");
|
92 |
rbOr.setPreferredSize(new java.awt.Dimension(60,25)); |
93 |
} |
94 |
return rbOr;
|
95 |
} |
96 |
|
97 |
/**
|
98 |
* Activa o desactiva el control
|
99 |
* @param enable True activa el control y false lo desactiva
|
100 |
*/
|
101 |
public void setControlEnabled(boolean enabled){ |
102 |
this.getRbAnd().setEnabled(enabled);
|
103 |
this.getRbOr().setEnabled(enabled);
|
104 |
} |
105 |
|
106 |
} |