svn-gvsig-desktop / tags / v1_0_2_Build_916 / extensions / extRasterTools / src / org / gvsig / rasterTools / saveRaster / ui / main / DoubleJTextInputPanel.java @ 12327
History | View | Annotate | Download (2.57 KB)
1 | 4547 | nacho | package org.gvsig.rasterTools.saveRaster.ui.main; |
---|---|---|---|
2 | |||
3 | import java.awt.Dimension; |
||
4 | import java.awt.FlowLayout; |
||
5 | |||
6 | import javax.swing.JLabel; |
||
7 | import javax.swing.JPanel; |
||
8 | import javax.swing.JTextField; |
||
9 | |||
10 | public class DoubleJTextInputPanel extends JPanel { |
||
11 | |||
12 | private JLabel lNameField = null; |
||
13 | private JLabel llabelField1 = null; |
||
14 | private JTextField tField1 = null; |
||
15 | private JLabel llabelField2 = null; |
||
16 | private JTextField tField2 = null; |
||
17 | |||
18 | /**
|
||
19 | * This is the default constructor
|
||
20 | */
|
||
21 | public DoubleJTextInputPanel() {
|
||
22 | super();
|
||
23 | initialize(); |
||
24 | } |
||
25 | |||
26 | /**
|
||
27 | * This method initializes this
|
||
28 | *
|
||
29 | * @return void
|
||
30 | */
|
||
31 | private void initialize() { |
||
32 | llabelField2 = new JLabel(); |
||
33 | llabelField2.setText(" Y: ");
|
||
34 | llabelField1 = new JLabel(); |
||
35 | llabelField1.setText("X: ");
|
||
36 | lNameField = new JLabel(); |
||
37 | lNameField.setText("Default Text ");
|
||
38 | FlowLayout flowLayout = new FlowLayout(); |
||
39 | flowLayout.setHgap(2);
|
||
40 | flowLayout.setAlignment(java.awt.FlowLayout.RIGHT); |
||
41 | flowLayout.setVgap(1);
|
||
42 | this.setLayout(flowLayout);
|
||
43 | 5829 | nacho | this.setSize(350, 21); |
44 | 4547 | nacho | this.setPreferredSize(new java.awt.Dimension(299,19)); |
45 | this.add(lNameField, null); |
||
46 | this.add(llabelField1, null); |
||
47 | this.add(getJTextField(), null); |
||
48 | this.add(llabelField2, null); |
||
49 | this.add(getJTextField1(), null); |
||
50 | } |
||
51 | |||
52 | /**
|
||
53 | * This method initializes jTextField
|
||
54 | *
|
||
55 | * @return javax.swing.JTextField
|
||
56 | */
|
||
57 | public JTextField getJTextField() { |
||
58 | if (tField1 == null) { |
||
59 | tField1 = new JTextField(); |
||
60 | tField1.setPreferredSize(new java.awt.Dimension(100,19)); |
||
61 | } |
||
62 | return tField1;
|
||
63 | } |
||
64 | |||
65 | /**
|
||
66 | * This method initializes jTextField1
|
||
67 | *
|
||
68 | * @return javax.swing.JTextField
|
||
69 | */
|
||
70 | public JTextField getJTextField1() { |
||
71 | if (tField2 == null) { |
||
72 | tField2 = new JTextField(); |
||
73 | tField2.setPreferredSize(new java.awt.Dimension(100,19)); |
||
74 | } |
||
75 | return tField2;
|
||
76 | } |
||
77 | |||
78 | /**
|
||
79 | * Asigna los textos al componente
|
||
80 | * @param label Texto de descripci?n del componente
|
||
81 | * @param llabelField1 texto asociado al field de la izquierda
|
||
82 | * @param llabelField2 texto asociado al field de la derecha
|
||
83 | */
|
||
84 | public void setTexts(String label, String llabelField1, String llabelField2){ |
||
85 | this.lNameField.setText(label);
|
||
86 | this.llabelField1.setText(llabelField1);
|
||
87 | this.llabelField2.setText(llabelField2);
|
||
88 | } |
||
89 | |||
90 | /**
|
||
91 | * Asigna el ancho al JTextField de la izquierda
|
||
92 | * @param width ancho del campo en pixeles
|
||
93 | */
|
||
94 | public void setWidthText1(int width){ |
||
95 | tField1.setPreferredSize(new Dimension(width, 19)); |
||
96 | } |
||
97 | |||
98 | /**
|
||
99 | * Asigna el ancho al JTextField de la derecha
|
||
100 | * @param width ancho del campo en pixeles
|
||
101 | */
|
||
102 | public void setWidthText2(int width){ |
||
103 | tField2.setPreferredSize(new Dimension(width, 19)); |
||
104 | } |
||
105 | } |