Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / saveraster / ui / main / DoubleJTextInputPanel.java @ 11549

History | View | Annotate | Download (3.59 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19
package org.gvsig.rastertools.saveraster.ui.main;
20

    
21
import java.awt.Dimension;
22
import java.awt.FlowLayout;
23

    
24
import javax.swing.JLabel;
25
import javax.swing.JPanel;
26
import javax.swing.JTextField;
27

    
28
/**
29
 * Panel con cajas de texto y etiquetas para entrada de una coordenadas X, Y
30
 * @version 18/04/2007
31
 * @author Nacho Brodin (nachobrodin@gmail.com)
32
 *
33
 */
34
public class DoubleJTextInputPanel extends JPanel {
35
        private static final long serialVersionUID = 1L;
36
        private JLabel lNameField = null;
37
        private JLabel llabelField1 = null;
38
        private JTextField tField1 = null;
39
        private JLabel llabelField2 = null;
40
        private JTextField tField2 = null;
41

    
42
        /**
43
         * This is the default constructor
44
         */
45
        public DoubleJTextInputPanel() {
46
                super();
47
                initialize();
48
        }
49

    
50
        /**
51
         * This method initializes this
52
         * 
53
         * @return void
54
         */
55
        private void initialize() {
56
                llabelField2 = new JLabel();
57
                llabelField2.setText(" Y: ");
58
                llabelField1 = new JLabel();
59
                llabelField1.setText("X: ");
60
                lNameField = new JLabel();
61
                lNameField.setText("Default Text ");
62
                FlowLayout flowLayout = new FlowLayout();
63
                flowLayout.setHgap(2);
64
                flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
65
                flowLayout.setVgap(1);
66
                this.setLayout(flowLayout);
67
                this.setSize(350, 21);
68
                this.setPreferredSize(new java.awt.Dimension(299,19));
69
                this.add(lNameField, null);
70
                this.add(llabelField1, null);
71
                this.add(getJTextField(), null);
72
                this.add(llabelField2, null);
73
                this.add(getJTextField1(), null);
74
        }
75

    
76
        /**
77
         * This method initializes jTextField        
78
         *         
79
         * @return javax.swing.JTextField        
80
         */
81
        public JTextField getJTextField() {
82
                if (tField1 == null) {
83
                        tField1 = new JTextField();
84
                        tField1.setPreferredSize(new java.awt.Dimension(100,19));
85
                }
86
                return tField1;
87
        }
88

    
89
        /**
90
         * This method initializes jTextField1        
91
         *         
92
         * @return javax.swing.JTextField        
93
         */
94
        public JTextField getJTextField1() {
95
                if (tField2 == null) {
96
                        tField2 = new JTextField();
97
                        tField2.setPreferredSize(new java.awt.Dimension(100,19));
98
                }
99
                return tField2;
100
        }
101

    
102
        /**
103
         * Asigna los textos al componente
104
         * @param label        Texto de descripci?n del componente
105
         * @param llabelField1 texto asociado al field de la izquierda
106
         * @param llabelField2 texto asociado al field de la derecha
107
         */
108
        public void setTexts(String label, String llabelField1, String llabelField2){
109
                this.lNameField.setText(label);
110
                this.llabelField1.setText(llabelField1);
111
                this.llabelField2.setText(llabelField2);
112
        }
113
        
114
        /**
115
         * Asigna el ancho al JTextField de la izquierda
116
         * @param width ancho del campo en pixeles
117
         */
118
        public void setWidthText1(int width){
119
                tField1.setPreferredSize(new Dimension(width, 19));
120
        }
121
        
122
        /**
123
         * Asigna el ancho al JTextField de la derecha
124
         * @param width ancho del campo en pixeles
125
         */
126
        public void setWidthText2(int width){
127
                tField2.setPreferredSize(new Dimension(width, 19));
128
        }
129
}