svn-gvsig-desktop / trunk / extensions / extRasterTools / src / com / iver / cit / gvsig / rasterTools / saveRaster / pruebas2 / InputSizeDataPanel.java @ 4269
History | View | Annotate | Download (3.17 KB)
1 |
package com.iver.cit.gvsig.rasterTools.saveRaster.pruebas2; |
---|---|
2 |
|
3 |
import javax.swing.JPanel; |
4 |
import javax.swing.JLabel; |
5 |
import javax.swing.JTextField; |
6 |
import javax.swing.JComboBox; |
7 |
|
8 |
import java.awt.Color; |
9 |
import java.awt.FlowLayout; |
10 |
|
11 |
public class InputSizeDataPanel extends JPanel { |
12 |
|
13 |
private JPanel pBorder = null; |
14 |
private JLabel lWidth = null; |
15 |
private JTextField tWidth = null; |
16 |
private JLabel lHeight = null; |
17 |
private JTextField tHeight = null; |
18 |
private JComboBox cbMeasureType = null; |
19 |
|
20 |
/**
|
21 |
* This is the default constructor
|
22 |
*/
|
23 |
public InputSizeDataPanel() {
|
24 |
super();
|
25 |
initialize(); |
26 |
this.setActive(false); |
27 |
} |
28 |
|
29 |
/**
|
30 |
* This method initializes this
|
31 |
*
|
32 |
* @return void
|
33 |
*/
|
34 |
private void initialize() { |
35 |
FlowLayout flowLayout = new FlowLayout(); |
36 |
flowLayout.setHgap(0);
|
37 |
flowLayout.setAlignment(java.awt.FlowLayout.LEFT); |
38 |
flowLayout.setVgap(0);
|
39 |
this.setLayout(flowLayout);
|
40 |
this.setSize(337, 28); |
41 |
this.setPreferredSize(new java.awt.Dimension(337,28)); |
42 |
this.add(getPBorder(), null); |
43 |
} |
44 |
|
45 |
/**
|
46 |
* This method initializes jPanel
|
47 |
*
|
48 |
* @return javax.swing.JPanel
|
49 |
*/
|
50 |
private JPanel getPBorder() { |
51 |
if (pBorder == null) { |
52 |
FlowLayout flowLayout1 = new FlowLayout(); |
53 |
flowLayout1.setAlignment(java.awt.FlowLayout.LEFT); |
54 |
flowLayout1.setVgap(2);
|
55 |
lHeight = new JLabel(); |
56 |
lHeight.setText("Alto:");
|
57 |
lWidth = new JLabel(); |
58 |
lWidth.setText("Ancho:");
|
59 |
pBorder = new JPanel(); |
60 |
pBorder.setLayout(flowLayout1); |
61 |
pBorder.setPreferredSize(new java.awt.Dimension(337,28)); |
62 |
pBorder.add(lWidth, null);
|
63 |
pBorder.add(getTWidth(), null);
|
64 |
pBorder.add(lHeight, null);
|
65 |
pBorder.add(getTHeight(), null);
|
66 |
pBorder.add(getCbMeasureType(), null);
|
67 |
} |
68 |
return pBorder;
|
69 |
} |
70 |
|
71 |
/**
|
72 |
* This method initializes jTextField
|
73 |
*
|
74 |
* @return javax.swing.JTextField
|
75 |
*/
|
76 |
private JTextField getTWidth() { |
77 |
if (tWidth == null) { |
78 |
tWidth = new JTextField(); |
79 |
tWidth.setPreferredSize(new java.awt.Dimension(65,19)); |
80 |
} |
81 |
return tWidth;
|
82 |
} |
83 |
|
84 |
/**
|
85 |
* This method initializes jTextField1
|
86 |
*
|
87 |
* @return javax.swing.JTextField
|
88 |
*/
|
89 |
private JTextField getTHeight() { |
90 |
if (tHeight == null) { |
91 |
tHeight = new JTextField(); |
92 |
tHeight.setPreferredSize(new java.awt.Dimension(65,19)); |
93 |
} |
94 |
return tHeight;
|
95 |
} |
96 |
|
97 |
/**
|
98 |
* This method initializes jComboBox
|
99 |
*
|
100 |
* @return javax.swing.JComboBox
|
101 |
*/
|
102 |
private JComboBox getCbMeasureType() { |
103 |
if (cbMeasureType == null) { |
104 |
cbMeasureType = new JComboBox(); |
105 |
cbMeasureType.setPreferredSize(new java.awt.Dimension(70,24)); |
106 |
cbMeasureType.addItem("Pixels");
|
107 |
cbMeasureType.addItem("Cms");
|
108 |
cbMeasureType.addItem("Mms");
|
109 |
cbMeasureType.addItem("Mts");
|
110 |
} |
111 |
return cbMeasureType;
|
112 |
} |
113 |
|
114 |
/**
|
115 |
* Activa o desactiva las cajas de texto con los datos
|
116 |
* ancho y alto.
|
117 |
* @param active true activa los JTextBox y false los desactiva
|
118 |
*/
|
119 |
public void setActive(boolean active){ |
120 |
Color backgroudColor = getBackground();
|
121 |
|
122 |
this.getTWidth().setEnabled(active);
|
123 |
this.getTHeight().setEnabled(active);
|
124 |
this.getCbMeasureType().setEnabled(active);
|
125 |
|
126 |
if(active){
|
127 |
getTWidth().setBackground(Color.white);
|
128 |
getTHeight().setBackground(Color.white);
|
129 |
}else{
|
130 |
getTWidth().setBackground(backgroudColor); |
131 |
getTHeight().setBackground(backgroudColor); |
132 |
} |
133 |
} |
134 |
} |