root / trunk / libraries / libJCRS / src / org / gvsig / crs / gui / panels / TransformationManualPanel.java @ 8304
History | View | Annotate | Download (14.2 KB)
1 | 7401 | jlgomez | package org.gvsig.crs.gui.panels; |
---|---|---|---|
2 | |||
3 | |||
4 | 7479 | jlgomez | import java.awt.BorderLayout; |
5 | 7401 | jlgomez | import java.awt.Component; |
6 | import java.awt.Dimension; |
||
7 | import java.awt.FlowLayout; |
||
8 | import java.awt.Font; |
||
9 | import java.awt.GridLayout; |
||
10 | import java.awt.event.ActionEvent; |
||
11 | 8127 | jlgomez | import java.awt.event.KeyEvent; |
12 | import java.awt.event.KeyListener; |
||
13 | 7401 | jlgomez | |
14 | import javax.swing.BorderFactory; |
||
15 | import javax.swing.JButton; |
||
16 | import javax.swing.JLabel; |
||
17 | 8127 | jlgomez | import javax.swing.JOptionPane; |
18 | 7401 | jlgomez | import javax.swing.JPanel; |
19 | import javax.swing.JScrollPane; |
||
20 | import javax.swing.JTextArea; |
||
21 | import javax.swing.JTextField; |
||
22 | |||
23 | import org.cresques.ui.DefaultDialogPanel; |
||
24 | 7479 | jlgomez | import org.gvsig.crs.CrsFactory; |
25 | import org.gvsig.crs.ICrs; |
||
26 | 7401 | jlgomez | |
27 | import com.iver.andami.PluginServices; |
||
28 | import com.iver.andami.ui.mdiManager.IWindow; |
||
29 | import com.iver.andami.ui.mdiManager.WindowInfo; |
||
30 | |||
31 | 8127 | jlgomez | public class TransformationManualPanel extends JPanel implements KeyListener{ |
32 | 7401 | jlgomez | |
33 | private static final long serialVersionUID = 1L; |
||
34 | |||
35 | private static boolean pressed = true; |
||
36 | |||
37 | private JLabel x_Translation; |
||
38 | private JLabel y_Translation; |
||
39 | private JLabel z_Translation; |
||
40 | private JLabel x_Rotation; |
||
41 | private JLabel y_Rotation; |
||
42 | private JLabel z_Rotation; |
||
43 | private JLabel scale; |
||
44 | |||
45 | private JTextField tx_Translation; |
||
46 | private JTextField ty_Translation; |
||
47 | private JTextField tz_Translation; |
||
48 | private JTextField tx_Rotation; |
||
49 | private JTextField ty_Rotation; |
||
50 | private JTextField tz_Rotation; |
||
51 | private JTextField tScale; |
||
52 | |||
53 | private JLabel wkt; |
||
54 | private JTextArea info; |
||
55 | private JScrollPane areaScrollPane; |
||
56 | 7479 | jlgomez | int codeEpsg;
|
57 | 7401 | jlgomez | |
58 | private JPanel panel; |
||
59 | |||
60 | 7479 | jlgomez | private String cadWKT = ""; |
61 | 7401 | jlgomez | |
62 | public TransformationManualPanel() {
|
||
63 | init(); |
||
64 | } |
||
65 | |||
66 | private void init() { |
||
67 | this.add(getJPanel(), null); |
||
68 | |||
69 | } |
||
70 | |||
71 | public JPanel getJPanel(){ |
||
72 | if (panel == null) { |
||
73 | panel = new JPanel(); |
||
74 | panel.setLayout(new GridLayout(0,4)); |
||
75 | panel.setLayout(new FlowLayout(FlowLayout.LEFT,10,20)); |
||
76 | panel.setBorder( |
||
77 | BorderFactory.createCompoundBorder(
|
||
78 | BorderFactory.createCompoundBorder(
|
||
79 | BorderFactory.createTitledBorder("Transformaci?n Manual"), |
||
80 | BorderFactory.createEmptyBorder(2,2,2,2)), |
||
81 | panel.getBorder())); |
||
82 | panel.setPreferredSize(new Dimension(525,400)); |
||
83 | 7479 | jlgomez | panel.add(getLabel()); |
84 | panel.add(getScrollPanelArea(), BorderLayout.NORTH);
|
||
85 | 7401 | jlgomez | panel.add(getX_Translation(),null);
|
86 | panel.add(getTx_Translation(),null);
|
||
87 | panel.add(getX_Rotation(),null);
|
||
88 | panel.add(getTx_Rotation(),null);
|
||
89 | panel.add(getY_Translation(),null);
|
||
90 | panel.add(getTy_Translation(),null);
|
||
91 | panel.add(getY_Rotation(),null);
|
||
92 | panel.add(getTy_Rotation(),null);
|
||
93 | panel.add(getZ_Translation(),null);
|
||
94 | panel.add(getTz_Translation(),null);
|
||
95 | panel.add(getZ_Rotation(),null);
|
||
96 | panel.add(getTz_Rotation(),null);
|
||
97 | panel.add(getScale(),null);
|
||
98 | panel.add(getTscale(),null);
|
||
99 | //panel.add(getJPanelParams(), null);
|
||
100 | //panel.add(getButtonPane(), null);
|
||
101 | } |
||
102 | return panel;
|
||
103 | } |
||
104 | |||
105 | |||
106 | private JLabel getX_Translation() { |
||
107 | if(x_Translation == null ) { |
||
108 | x_Translation = new JLabel(); |
||
109 | x_Translation.setPreferredSize(new Dimension(120,20)); |
||
110 | 7479 | jlgomez | //x_Translation.setFont(new Font("x_Translation:",Font.BOLD,15));
|
111 | 7401 | jlgomez | x_Translation.setText(PluginServices.getText(this,"x_Translation:")); |
112 | 8127 | jlgomez | |
113 | 7401 | jlgomez | } |
114 | return x_Translation;
|
||
115 | } |
||
116 | |||
117 | private JLabel getY_Translation() { |
||
118 | if(y_Translation == null ) { |
||
119 | y_Translation = new JLabel(); |
||
120 | y_Translation.setPreferredSize(new Dimension(120,20)); |
||
121 | 7479 | jlgomez | //y_Translation.setFont(new Font("y_Translation:",Font.BOLD,15));
|
122 | 7401 | jlgomez | y_Translation.setText(PluginServices.getText(this,"y_Translation:")); |
123 | 8127 | jlgomez | |
124 | 7401 | jlgomez | } |
125 | return y_Translation;
|
||
126 | } |
||
127 | |||
128 | private JLabel getZ_Translation() { |
||
129 | if(z_Translation == null ) { |
||
130 | z_Translation = new JLabel(); |
||
131 | z_Translation.setPreferredSize(new Dimension(120,20)); |
||
132 | 7479 | jlgomez | //z_Translation.setFont(new Font("z_Translation:",Font.BOLD,15));
|
133 | 7401 | jlgomez | z_Translation.setText(PluginServices.getText(this,"z_Translation:")); |
134 | 8127 | jlgomez | |
135 | 7401 | jlgomez | } |
136 | return z_Translation;
|
||
137 | } |
||
138 | |||
139 | private JLabel getX_Rotation() { |
||
140 | if(x_Rotation == null ) { |
||
141 | x_Rotation = new JLabel(); |
||
142 | x_Rotation.setPreferredSize(new Dimension(120,20)); |
||
143 | 7479 | jlgomez | //x_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15));
|
144 | 7401 | jlgomez | x_Rotation.setText(PluginServices.getText(this,"x_Rotation:")); |
145 | 8127 | jlgomez | |
146 | 7401 | jlgomez | } |
147 | return x_Rotation;
|
||
148 | } |
||
149 | |||
150 | private JLabel getY_Rotation() { |
||
151 | if(y_Rotation == null ) { |
||
152 | y_Rotation = new JLabel(); |
||
153 | y_Rotation.setPreferredSize(new Dimension(120,20)); |
||
154 | 7479 | jlgomez | //y_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15));
|
155 | 7401 | jlgomez | y_Rotation.setText(PluginServices.getText(this,"y_Rotation:")); |
156 | 8127 | jlgomez | |
157 | 7401 | jlgomez | } |
158 | return y_Rotation;
|
||
159 | } |
||
160 | |||
161 | private JLabel getZ_Rotation() { |
||
162 | if(z_Rotation == null ) { |
||
163 | z_Rotation = new JLabel(); |
||
164 | z_Rotation.setPreferredSize(new Dimension(120,20)); |
||
165 | 7479 | jlgomez | //z_Rotation.setFont(new Font("x_Translation:",Font.BOLD,15));
|
166 | 7401 | jlgomez | z_Rotation.setText(PluginServices.getText(this,"z_Rotation:")); |
167 | 8127 | jlgomez | |
168 | 7401 | jlgomez | } |
169 | return z_Rotation;
|
||
170 | } |
||
171 | |||
172 | private JLabel getScale() { |
||
173 | if(scale == null ) { |
||
174 | scale = new JLabel(); |
||
175 | scale.setPreferredSize(new Dimension(120,20)); |
||
176 | 7479 | jlgomez | //scale.setFont(new Font("scale:",Font.BOLD,15));
|
177 | 7401 | jlgomez | scale.setText(PluginServices.getText(this,"scale:")); |
178 | 8127 | jlgomez | |
179 | 7401 | jlgomez | } |
180 | return scale;
|
||
181 | } |
||
182 | |||
183 | private JTextField getTx_Translation() { |
||
184 | if(tx_Translation == null ) { |
||
185 | tx_Translation = new JTextField(); |
||
186 | tx_Translation.setPreferredSize(new Dimension(120,20)); |
||
187 | 7479 | jlgomez | //tx_Translation.setFont(new Font("",Font.ITALIC,10));
|
188 | tx_Translation.setText("0");
|
||
189 | 7401 | jlgomez | tx_Translation.setEditable(true);
|
190 | 8127 | jlgomez | tx_Translation.addKeyListener(this);
|
191 | 7401 | jlgomez | } |
192 | return tx_Translation;
|
||
193 | } |
||
194 | |||
195 | private JTextField getTy_Translation() { |
||
196 | if(ty_Translation == null ) { |
||
197 | ty_Translation = new JTextField(); |
||
198 | ty_Translation.setPreferredSize(new Dimension(120,20)); |
||
199 | 7479 | jlgomez | //ty_Translation.setFont(new Font("",Font.ITALIC,10));
|
200 | ty_Translation.setText("0");
|
||
201 | 7401 | jlgomez | ty_Translation.setEditable(true);
|
202 | 8127 | jlgomez | ty_Translation.addKeyListener(this);
|
203 | 7401 | jlgomez | } |
204 | return ty_Translation;
|
||
205 | } |
||
206 | |||
207 | private JTextField getTz_Translation() { |
||
208 | if(tz_Translation == null ) { |
||
209 | tz_Translation = new JTextField(); |
||
210 | tz_Translation.setPreferredSize(new Dimension(120,20)); |
||
211 | 7479 | jlgomez | //tz_Translation.setFont(new Font("",Font.ITALIC,10));
|
212 | tz_Translation.setText("0");
|
||
213 | 7401 | jlgomez | tz_Translation.setEditable(true);
|
214 | 8127 | jlgomez | tz_Translation.addKeyListener(this);
|
215 | 7401 | jlgomez | } |
216 | return tz_Translation;
|
||
217 | } |
||
218 | |||
219 | private JTextField getTx_Rotation() { |
||
220 | if(tx_Rotation == null ) { |
||
221 | tx_Rotation = new JTextField(); |
||
222 | tx_Rotation.setPreferredSize(new Dimension(120,20)); |
||
223 | 7479 | jlgomez | //tx_Rotation.setFont(new Font("",Font.ITALIC,10));
|
224 | tx_Rotation.setText("0");
|
||
225 | 7401 | jlgomez | tx_Rotation.setEditable(true);
|
226 | 8127 | jlgomez | tx_Rotation.addKeyListener(this);
|
227 | 7401 | jlgomez | } |
228 | return tx_Rotation;
|
||
229 | } |
||
230 | |||
231 | private JTextField getTy_Rotation() { |
||
232 | if(ty_Rotation == null ) { |
||
233 | ty_Rotation = new JTextField(); |
||
234 | ty_Rotation.setPreferredSize(new Dimension(120,20)); |
||
235 | 7479 | jlgomez | //ty_Rotation.setFont(new Font("",Font.ITALIC,10));
|
236 | ty_Rotation.setText("0");
|
||
237 | 7401 | jlgomez | ty_Rotation.setEditable(true);
|
238 | 8127 | jlgomez | ty_Rotation.addKeyListener(this);
|
239 | 7401 | jlgomez | } |
240 | return ty_Rotation;
|
||
241 | } |
||
242 | |||
243 | private JTextField getTz_Rotation() { |
||
244 | if(tz_Rotation == null ) { |
||
245 | tz_Rotation = new JTextField(); |
||
246 | tz_Rotation.setPreferredSize(new Dimension(120,20)); |
||
247 | 7479 | jlgomez | //tz_Rotation.setFont(new Font("",Font.ITALIC,10));
|
248 | tz_Rotation.setText("0");
|
||
249 | 7401 | jlgomez | tz_Rotation.setEditable(true);
|
250 | 8127 | jlgomez | tz_Rotation.addKeyListener(this);
|
251 | 7401 | jlgomez | } |
252 | return tz_Rotation;
|
||
253 | } |
||
254 | |||
255 | private JTextField getTscale() { |
||
256 | if(tScale == null ) { |
||
257 | tScale = new JTextField(); |
||
258 | tScale.setPreferredSize(new Dimension(120,20)); |
||
259 | 7479 | jlgomez | //tScale.setFont(new Font("",Font.ITALIC,10));
|
260 | tScale.setText("0");
|
||
261 | 7401 | jlgomez | tScale.setEditable(true);
|
262 | 8127 | jlgomez | tScale.addKeyListener(this);
|
263 | 7401 | jlgomez | } |
264 | return tScale;
|
||
265 | } |
||
266 | |||
267 | private JScrollPane getScrollPanelArea() { |
||
268 | if(areaScrollPane == null) { |
||
269 | areaScrollPane = new JScrollPane(getInfo()); |
||
270 | areaScrollPane.setVerticalScrollBarPolicy( |
||
271 | JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
|
||
272 | areaScrollPane.setPreferredSize(new Dimension(420, 100)); |
||
273 | areaScrollPane.setBorder( |
||
274 | BorderFactory.createCompoundBorder(
|
||
275 | BorderFactory.createCompoundBorder(
|
||
276 | BorderFactory.createTitledBorder("Wkt"), |
||
277 | BorderFactory.createEmptyBorder(2,2,2,2)), |
||
278 | areaScrollPane.getBorder())); |
||
279 | } |
||
280 | return areaScrollPane;
|
||
281 | } |
||
282 | |||
283 | private Component getLabel() { |
||
284 | if (wkt == null){ |
||
285 | wkt = new JLabel(); |
||
286 | wkt.setPreferredSize(new Dimension(90, 80)); |
||
287 | wkt.setText("Cadena WKT: ");
|
||
288 | } |
||
289 | return wkt;
|
||
290 | } |
||
291 | |||
292 | private Component getInfo() { |
||
293 | if (info == null){ |
||
294 | info = new JTextArea(); |
||
295 | info.setLineWrap(true);
|
||
296 | info.setWrapStyleWord(true);
|
||
297 | info.setPreferredSize(new Dimension(400, 240)); |
||
298 | info.setEditable(false);
|
||
299 | 7479 | jlgomez | info.setText(getWKT()); |
300 | 7401 | jlgomez | } |
301 | 7479 | jlgomez | info.setText(getWKT()); |
302 | 7401 | jlgomez | return info;
|
303 | } |
||
304 | |||
305 | 7479 | jlgomez | public ICrs getProjection() {
|
306 | 8304 | jlgomez | if(tx_Translation.getText().equals("")){ |
307 | tx_Translation.setText("0");
|
||
308 | } |
||
309 | else if (ty_Translation.getText().equals("")){ |
||
310 | ty_Translation.setText("0");
|
||
311 | } |
||
312 | else if (tz_Translation.getText().equals("")){ |
||
313 | tz_Translation.setText("0");
|
||
314 | } |
||
315 | else if (tx_Rotation.getText().equals("")){ |
||
316 | tx_Rotation.setText("0");
|
||
317 | } |
||
318 | else if (ty_Rotation.getText().equals("")){ |
||
319 | ty_Rotation.setText("0");
|
||
320 | } |
||
321 | else if (tz_Rotation.getText().equals("")){ |
||
322 | tz_Rotation.setText("0");
|
||
323 | } |
||
324 | else if (tScale.getText().equals("")){ |
||
325 | tScale.setText("0");
|
||
326 | } |
||
327 | 7479 | jlgomez | String param = tx_Translation.getText()+","+ |
328 | ty_Translation.getText()+","+
|
||
329 | tz_Translation.getText()+","+
|
||
330 | tx_Rotation.getText()+","+
|
||
331 | ty_Rotation.getText()+","+
|
||
332 | tz_Rotation.getText()+","+
|
||
333 | 7480 | jlgomez | tScale.getText() + " ";
|
334 | 7479 | jlgomez | |
335 | try {
|
||
336 | ICrs crs = new CrsFactory().getCRS(getCode(),
|
||
337 | getWKT(),param); |
||
338 | return crs;
|
||
339 | } catch (org.gvsig.crs.CrsException e) {
|
||
340 | e.printStackTrace(); |
||
341 | 7401 | jlgomez | } |
342 | 7479 | jlgomez | return null; |
343 | 7401 | jlgomez | } |
344 | |||
345 | 7479 | jlgomez | public void setCode(int cod){ |
346 | codeEpsg = cod; |
||
347 | 7401 | jlgomez | } |
348 | |||
349 | 7479 | jlgomez | public int getCode(){ |
350 | return codeEpsg;
|
||
351 | 7401 | jlgomez | } |
352 | |||
353 | 7479 | jlgomez | public void setWKT(String cad){ |
354 | cadWKT = cad; |
||
355 | getInfo(); |
||
356 | 7401 | jlgomez | } |
357 | |||
358 | 7479 | jlgomez | public String getWKT(){ |
359 | return cadWKT;
|
||
360 | 7401 | jlgomez | } |
361 | 7479 | jlgomez | |
362 | 7401 | jlgomez | public static boolean isPressed() { return pressed; } |
363 | |||
364 | 8127 | jlgomez | public void keyPressed(KeyEvent e) { |
365 | // TODO Auto-generated method stub
|
||
366 | if (e.getSource() == this.getTx_Translation()) { |
||
367 | if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || |
||
368 | (e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){ |
||
369 | } |
||
370 | else {
|
||
371 | JOptionPane.showMessageDialog(TransformationManualPanel.this,
|
||
372 | "Only number format.",
|
||
373 | "Warning...", JOptionPane.WARNING_MESSAGE); |
||
374 | String aux = tx_Translation.getText();
|
||
375 | if (aux.length() == 1 || aux.length() == 0){ |
||
376 | tx_Translation.setText("");
|
||
377 | } |
||
378 | else {
|
||
379 | tx_Translation.setText(aux.substring(0, aux.length()-1)); |
||
380 | } |
||
381 | } |
||
382 | } |
||
383 | |||
384 | if (e.getSource() == this.getTx_Rotation()) { |
||
385 | if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || |
||
386 | (e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){ |
||
387 | } |
||
388 | else {
|
||
389 | JOptionPane.showMessageDialog(TransformationManualPanel.this,
|
||
390 | "Only number format.",
|
||
391 | "Warning...", JOptionPane.WARNING_MESSAGE); |
||
392 | String aux = tx_Rotation.getText();
|
||
393 | if (aux.length() == 1 || aux.length() == 0){ |
||
394 | tx_Rotation.setText("");
|
||
395 | } |
||
396 | else {
|
||
397 | tx_Rotation.setText(aux.substring(0, aux.length()-1)); |
||
398 | } |
||
399 | } |
||
400 | } |
||
401 | |||
402 | if (e.getSource() == this.getTy_Translation()) { |
||
403 | if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || |
||
404 | (e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){ |
||
405 | } |
||
406 | else {
|
||
407 | JOptionPane.showMessageDialog(TransformationManualPanel.this,
|
||
408 | "Only number format.",
|
||
409 | "Warning...", JOptionPane.WARNING_MESSAGE); |
||
410 | String aux = ty_Translation.getText();
|
||
411 | if (aux.length() == 1 || aux.length() == 0){ |
||
412 | ty_Translation.setText("");
|
||
413 | } |
||
414 | else {
|
||
415 | ty_Translation.setText(aux.substring(0, aux.length()-1)); |
||
416 | } |
||
417 | } |
||
418 | } |
||
419 | |||
420 | if (e.getSource() == this.getTy_Rotation()) { |
||
421 | if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || |
||
422 | (e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){ |
||
423 | } |
||
424 | else {
|
||
425 | JOptionPane.showMessageDialog(TransformationManualPanel.this,
|
||
426 | "Only number format.",
|
||
427 | "Warning...", JOptionPane.WARNING_MESSAGE); |
||
428 | String aux = ty_Rotation.getText();
|
||
429 | if (aux.length() == 1 || aux.length() == 0){ |
||
430 | ty_Rotation.setText("");
|
||
431 | } |
||
432 | else {
|
||
433 | ty_Rotation.setText(aux.substring(0, aux.length()-1)); |
||
434 | } |
||
435 | } |
||
436 | } |
||
437 | |||
438 | if (e.getSource() == this.getTz_Translation()) { |
||
439 | if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || |
||
440 | (e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){ |
||
441 | } |
||
442 | else {
|
||
443 | JOptionPane.showMessageDialog(TransformationManualPanel.this,
|
||
444 | "Only number format.",
|
||
445 | "Warning...", JOptionPane.WARNING_MESSAGE); |
||
446 | String aux = tz_Translation.getText();
|
||
447 | if (aux.length() == 1 || aux.length() == 0){ |
||
448 | tz_Translation.setText("");
|
||
449 | } |
||
450 | else {
|
||
451 | tz_Translation.setText(aux.substring(0, aux.length()-1)); |
||
452 | } |
||
453 | } |
||
454 | } |
||
455 | |||
456 | if (e.getSource() == this.getTz_Rotation()) { |
||
457 | if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || |
||
458 | (e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){ |
||
459 | } |
||
460 | else {
|
||
461 | JOptionPane.showMessageDialog(TransformationManualPanel.this,
|
||
462 | "Only number format.",
|
||
463 | "Warning...", JOptionPane.WARNING_MESSAGE); |
||
464 | String aux = tz_Rotation.getText();
|
||
465 | if (aux.length() == 1 || aux.length() == 0){ |
||
466 | tz_Rotation.setText("");
|
||
467 | } |
||
468 | else {
|
||
469 | tz_Rotation.setText(aux.substring(0, aux.length()-1)); |
||
470 | } |
||
471 | } |
||
472 | } |
||
473 | |||
474 | if (e.getSource() == this.getTscale()) { |
||
475 | if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || |
||
476 | (e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){ |
||
477 | } |
||
478 | else {
|
||
479 | JOptionPane.showMessageDialog(TransformationManualPanel.this,
|
||
480 | "Only number format.",
|
||
481 | "Warning...", JOptionPane.WARNING_MESSAGE); |
||
482 | String aux = tScale.getText();
|
||
483 | if (aux.length() == 1 || aux.length() == 0){ |
||
484 | tScale.setText("");
|
||
485 | } |
||
486 | else {
|
||
487 | tScale.setText(aux.substring(0, aux.length()-1)); |
||
488 | } |
||
489 | } |
||
490 | } |
||
491 | } |
||
492 | 7401 | jlgomez | |
493 | 8127 | jlgomez | public void keyReleased(KeyEvent e) { |
494 | // TODO Auto-generated method stub
|
||
495 | |||
496 | } |
||
497 | |||
498 | public void keyTyped(KeyEvent e) { |
||
499 | // TODO Auto-generated method stub
|
||
500 | |||
501 | } |
||
502 | |||
503 | |||
504 | 7401 | jlgomez | } |