root / trunk / libraries / libCq_CMS_praster / src / org / cresques / ui / raster / AddRemoveButtonsPanel.java @ 8026
History | View | Annotate | Download (2.58 KB)
1 |
package org.cresques.ui.raster; |
---|---|
2 |
|
3 |
import javax.swing.JPanel; |
4 |
import javax.swing.JButton; |
5 |
|
6 |
import java.awt.Color; |
7 |
import java.awt.GridBagLayout; |
8 |
import java.awt.GridBagConstraints; |
9 |
import java.awt.FlowLayout; |
10 |
import javax.swing.ImageIcon; |
11 |
|
12 |
public class AddRemoveButtonsPanel extends JPanel { |
13 |
|
14 |
private JPanel pBorder = null; |
15 |
private JButton bAdd = null; |
16 |
private JButton bRemove = null; |
17 |
|
18 |
/**
|
19 |
* This is the default constructor
|
20 |
*/
|
21 |
public AddRemoveButtonsPanel() {
|
22 |
super();
|
23 |
initialize(); |
24 |
} |
25 |
|
26 |
/**
|
27 |
* This method initializes this
|
28 |
*
|
29 |
* @return void
|
30 |
*/
|
31 |
private void initialize() { |
32 |
FlowLayout flowLayout = new FlowLayout(); |
33 |
flowLayout.setHgap(0);
|
34 |
flowLayout.setVgap(0);
|
35 |
this.setLayout(flowLayout);
|
36 |
this.setSize(26, 52); |
37 |
this.add(getJPanel(), null); |
38 |
} |
39 |
|
40 |
/**
|
41 |
* This method initializes jPanel
|
42 |
*
|
43 |
* @return javax.swing.JPanel
|
44 |
*/
|
45 |
private JPanel getJPanel() { |
46 |
if (pBorder == null) { |
47 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
48 |
gridBagConstraints1.insets = new java.awt.Insets(3,3,3,3); |
49 |
gridBagConstraints1.gridy = 1;
|
50 |
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; |
51 |
gridBagConstraints1.gridx = 0;
|
52 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
53 |
gridBagConstraints.insets = new java.awt.Insets(3,3,3,3); |
54 |
gridBagConstraints.gridy = 0;
|
55 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
56 |
gridBagConstraints.gridx = 0;
|
57 |
pBorder = new JPanel(); |
58 |
pBorder.setLayout(new GridBagLayout()); |
59 |
pBorder.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0)); |
60 |
pBorder.add(getBAdd(), gridBagConstraints); |
61 |
pBorder.add(getBRemove(), gridBagConstraints1); |
62 |
} |
63 |
return pBorder;
|
64 |
} |
65 |
|
66 |
/**
|
67 |
* This method initializes jButton
|
68 |
*
|
69 |
* @return javax.swing.JButton
|
70 |
*/
|
71 |
public JButton getBAdd() { |
72 |
if (bAdd == null) { |
73 |
bAdd = new JButton(); |
74 |
bAdd.setPreferredSize(new java.awt.Dimension(20,20)); |
75 |
bAdd.setIcon(new ImageIcon("./gvSIG/extensiones/com.iver.cit.gvsig/images/forward.png")); |
76 |
} |
77 |
return bAdd;
|
78 |
} |
79 |
|
80 |
/**
|
81 |
* This method initializes jButton1
|
82 |
*
|
83 |
* @return javax.swing.JButton
|
84 |
*/
|
85 |
public JButton getBRemove() { |
86 |
if (bRemove == null) { |
87 |
bRemove = new JButton(); |
88 |
bRemove.setPreferredSize(new java.awt.Dimension(20,20)); |
89 |
bRemove.setIcon(new ImageIcon("./gvSIG/extensiones/com.iver.cit.gvsig/images/backward.png")); |
90 |
} |
91 |
return bRemove;
|
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.getBAdd().setEnabled(enabled);
|
100 |
this.getBRemove().setEnabled(enabled);
|
101 |
} |
102 |
|
103 |
} |