Revision 12282 trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/textincreaser/TextIncreaserContainer.java
TextIncreaserContainer.java | ||
---|---|---|
18 | 18 |
*/ |
19 | 19 |
package org.gvsig.gui.beans.textincreaser; |
20 | 20 |
|
21 |
import java.awt.Dimension; |
|
21 | 22 |
import java.awt.FlowLayout; |
22 | 23 |
import java.awt.GridBagConstraints; |
23 | 24 |
import java.awt.GridBagLayout; |
... | ... | |
38 | 39 |
public class TextIncreaserContainer extends JPanel implements ActionListener, KeyListener{ |
39 | 40 |
private static final long serialVersionUID = 7570162018139822874L; |
40 | 41 |
private ArrayList actionCommandListeners = new ArrayList(); |
41 |
private int width = 70; |
|
42 | 42 |
private JTextField tText = null; |
43 | 43 |
private JPanel pButtons = null; |
44 | 44 |
private JButton bmas = null; |
... | ... | |
66 | 66 |
*/ |
67 | 67 |
public TextIncreaserContainer(int width, double minValue, double maxValue, double init, boolean right) { |
68 | 68 |
super(); |
69 |
this.width = width;
|
|
69 |
getTText().setPreferredSize(new Dimension(width - 34, (int) getTText().getPreferredSize().getHeight()));
|
|
70 | 70 |
this.minValue = minValue; |
71 | 71 |
this.maxValue = maxValue; |
72 | 72 |
this.isRight = right; |
... | ... | |
86 | 86 |
flowLayout5.setVgap(0); |
87 | 87 |
this.setLayout(flowLayout5); |
88 | 88 |
// this.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1)); |
89 |
this.setSize(new java.awt.Dimension(width, width)); |
|
90 |
this.setPreferredSize(new java.awt.Dimension(width, width)); |
|
89 |
// this.setSize(new java.awt.Dimension(width, width));
|
|
90 |
// this.setPreferredSize(new java.awt.Dimension(width, width));
|
|
91 | 91 |
this.add(getPGeneral(), null); |
92 | 92 |
} |
93 | 93 |
|
... | ... | |
109 | 109 |
} |
110 | 110 |
|
111 | 111 |
/** |
112 |
* This method initializes jTextField
|
|
113 |
*
|
|
114 |
* @return javax.swing.JTextField
|
|
112 |
* This method initializes jTextField |
|
113 |
* |
|
114 |
* @return javax.swing.JTextField |
|
115 | 115 |
*/ |
116 | 116 |
private JTextField getTText() { |
117 | 117 |
if (tText == null) { |
118 | 118 |
tText = new JTextField(); |
119 | 119 |
tText.setText(Double.toString(value)); |
120 |
tText.setPreferredSize(new java.awt.Dimension(width - 25,25));
|
|
120 |
tText.setPreferredSize(new java.awt.Dimension(45, (int) tText.getPreferredSize().getHeight()));
|
|
121 | 121 |
tText.addKeyListener(this); |
122 | 122 |
} |
123 | 123 |
return tText; |
124 | 124 |
} |
125 | 125 |
|
126 | 126 |
/** |
127 |
* This method initializes jPanel
|
|
128 |
*
|
|
129 |
* @return javax.swing.JPanel
|
|
127 |
* This method initializes jPanel |
|
128 |
* |
|
129 |
* @return javax.swing.JPanel |
|
130 | 130 |
*/ |
131 | 131 |
private JPanel getPButtons() { |
132 | 132 |
if (pButtons == null) { |
... | ... | |
140 | 140 |
gridBagConstraints2.gridx = 0; |
141 | 141 |
pButtons = new JPanel(); |
142 | 142 |
pButtons.setLayout(new GridBagLayout()); |
143 |
pButtons.setPreferredSize(new java.awt.Dimension(25,25)); |
|
144 | 143 |
pButtons.add(getBmas(), gridBagConstraints2); |
145 | 144 |
pButtons.add(getBmenos(), gridBagConstraints3); |
146 | 145 |
} |
... | ... | |
148 | 147 |
} |
149 | 148 |
|
150 | 149 |
/** |
151 |
* This method initializes jButton
|
|
152 |
*
|
|
153 |
* @return javax.swing.JButton
|
|
150 |
* This method initializes jButton |
|
151 |
* |
|
152 |
* @return javax.swing.JButton |
|
154 | 153 |
*/ |
155 | 154 |
private JButton getBmas() { |
156 | 155 |
if (bmas == null) { |
157 | 156 |
bmas = new JButton(); |
158 |
bmas.setPreferredSize(new java.awt.Dimension(25,12));
|
|
157 |
bmas.setPreferredSize(new java.awt.Dimension(16, (int) getTText().getPreferredSize().getHeight()/2));
|
|
159 | 158 |
bmas.addActionListener(this); |
160 | 159 |
bmas.setIcon(new ImageIcon(getClass().getResource(pathToImages + "mas.png"))); |
161 | 160 |
} |
... | ... | |
163 | 162 |
} |
164 | 163 |
|
165 | 164 |
/** |
166 |
* This method initializes jButton1
|
|
167 |
*
|
|
168 |
* @return javax.swing.JButton
|
|
165 |
* This method initializes jButton1 |
|
166 |
* |
|
167 |
* @return javax.swing.JButton |
|
169 | 168 |
*/ |
170 | 169 |
private JButton getBmenos() { |
171 | 170 |
if (bmenos == null) { |
172 | 171 |
bmenos = new JButton(); |
173 |
bmenos.setPreferredSize(new java.awt.Dimension(25,12));
|
|
172 |
bmenos.setPreferredSize(new java.awt.Dimension(16, (int) getTText().getPreferredSize().getHeight()/2));
|
|
174 | 173 |
bmenos.addActionListener(this); |
175 | 174 |
bmenos.setIcon(new ImageIcon(getClass().getResource(pathToImages + "menos.png"))); |
176 | 175 |
} |
... | ... | |
178 | 177 |
} |
179 | 178 |
|
180 | 179 |
/** |
181 |
* This method initializes jPanel
|
|
182 |
*
|
|
183 |
* @return javax.swing.JPanel
|
|
180 |
* This method initializes jPanel |
|
181 |
* |
|
182 |
* @return javax.swing.JPanel |
|
184 | 183 |
*/ |
185 | 184 |
private JPanel getPGeneral() { |
186 | 185 |
if (pGeneral == null) { |
... | ... | |
200 | 199 |
gridBagConstraints.weightx = 1.0; |
201 | 200 |
pGeneral = new JPanel(); |
202 | 201 |
pGeneral.setLayout(new GridBagLayout()); |
203 |
pGeneral.setPreferredSize(new java.awt.Dimension(width, 25)); |
|
204 | 202 |
pGeneral.add(getTText(), gridBagConstraints); |
205 | 203 |
pGeneral.add(getPButtons(), gridBagConstraints1); |
206 | 204 |
} |
... | ... | |
258 | 256 |
} |
259 | 257 |
} |
260 | 258 |
|
261 |
/* |
|
262 |
* (non-Javadoc) |
|
263 |
* @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent) |
|
264 |
*/ |
|
265 |
public void keyReleased(KeyEvent e) { |
|
266 |
} |
|
267 |
|
|
268 |
/* |
|
269 |
* (non-Javadoc) |
|
270 |
* @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent) |
|
271 |
*/ |
|
272 |
public void keyTyped(KeyEvent e) { |
|
273 |
} |
|
259 |
public void keyReleased(KeyEvent e) {} |
|
260 |
public void keyTyped(KeyEvent e) {} |
|
274 | 261 |
} |
Also available in: Unified diff