Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extRasterTools / src / com / iver / cit / gvsig / rasterTools / saveRaster / pruebas2 / InputSizeDataPanel.java @ 4444

History | View | Annotate | Download (3.93 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
        private JPanel jPanel = null;
20

    
21
        /**
22
         * This is the default constructor
23
         */
24
        public InputSizeDataPanel() {
25
                super();
26
                initialize();
27
                this.setActive(false);
28
        }
29

    
30
        /**
31
         * This method initializes this
32
         * 
33
         * @return void
34
         */
35
        private void initialize() {
36
                FlowLayout flowLayout = new FlowLayout();
37
                flowLayout.setHgap(0);
38
                flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
39
                flowLayout.setVgap(0);
40
                this.setLayout(flowLayout);
41
                this.setSize(337, 28);
42
                this.setPreferredSize(new java.awt.Dimension(337,28));
43
                this.add(getPBorder(), null);
44
        }
45

    
46
        /**
47
         * This method initializes jPanel        
48
         *         
49
         * @return javax.swing.JPanel        
50
         */
51
        private JPanel getPBorder() {
52
                if (pBorder == null) {
53
                        FlowLayout flowLayout1 = new FlowLayout();
54
                        flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
55
                        flowLayout1.setHgap(0);
56
                        flowLayout1.setVgap(4);
57
                        lHeight = new JLabel();
58
                        lHeight.setText("Alto:");
59
                        lWidth = new JLabel();
60
                        lWidth.setText("Ancho:");
61
                        pBorder = new JPanel();
62
                        pBorder.setLayout(flowLayout1);
63
                        pBorder.setPreferredSize(new java.awt.Dimension(337,28));
64
                        pBorder.add(lWidth, null);
65
                        pBorder.add(getTWidth(), null);
66
                        pBorder.add(lHeight, null);
67
                        pBorder.add(getTHeight(), null);
68
                        pBorder.add(getJPanel(), null);
69
                }
70
                return pBorder;
71
        }
72

    
73
        /**
74
         * This method initializes jTextField        
75
         *         
76
         * @return javax.swing.JTextField        
77
         */
78
        private JTextField getTWidth() {
79
                if (tWidth == null) {
80
                        tWidth = new JTextField();
81
                        tWidth.setPreferredSize(new java.awt.Dimension(65,19));
82
                }
83
                return tWidth;
84
        }
85

    
86
        /**
87
         * This method initializes jTextField1        
88
         *         
89
         * @return javax.swing.JTextField        
90
         */
91
        private JTextField getTHeight() {
92
                if (tHeight == null) {
93
                        tHeight = new JTextField();
94
                        tHeight.setPreferredSize(new java.awt.Dimension(65,19));
95
                }
96
                return tHeight;
97
        }
98

    
99
        /**
100
         * This method initializes jComboBox        
101
         *         
102
         * @return javax.swing.JComboBox        
103
         */
104
        private JComboBox getCbMeasureType() {
105
                if (cbMeasureType == null) {
106
                        cbMeasureType = new JComboBox();
107
                        cbMeasureType.setPreferredSize(new java.awt.Dimension(70,24));
108
                        cbMeasureType.addItem("Pixels");
109
                        cbMeasureType.addItem("Cms");
110
                        cbMeasureType.addItem("Mms");
111
                        cbMeasureType.addItem("Mts");
112
                }
113
                return cbMeasureType;
114
        }
115

    
116
        /**
117
         * Activa o desactiva las cajas de texto con los datos
118
         * ancho y alto.
119
         * @param active true activa los JTextBox y false los desactiva
120
         */
121
        public void setActive(boolean active){
122
                Color backgroudColor = getBackground();
123
                
124
                this.getTWidth().setEnabled(active);
125
                this.getTHeight().setEnabled(active);
126
                this.getCbMeasureType().setEnabled(active);
127
                
128
                if(active){
129
                        getTWidth().setBackground(Color.white);
130
                        getTHeight().setBackground(Color.white);
131
                }else{
132
                        getTWidth().setBackground(backgroudColor);
133
                        getTHeight().setBackground(backgroudColor);
134
                }
135
        }
136

    
137
        /**
138
         * This method initializes jPanel        
139
         *         
140
         * @return javax.swing.JPanel        
141
         */
142
        private JPanel getJPanel() {
143
                if (jPanel == null) {
144
                        FlowLayout flowLayout2 = new FlowLayout();
145
                        flowLayout2.setAlignment(java.awt.FlowLayout.RIGHT);
146
                        flowLayout2.setVgap(0);
147
                        flowLayout2.setHgap(14);
148
                        jPanel = new JPanel();
149
                        jPanel.setLayout(flowLayout2);
150
                        jPanel.setPreferredSize(new java.awt.Dimension(102,28));
151
                        jPanel.add(getCbMeasureType(), null);
152
                }
153
                return jPanel;
154
        }
155
        
156
        /**
157
         * Obtiene la etiqueta con el valor ancho
158
         * @return
159
         */
160
        public JLabel getLWidth(){
161
                return this.lWidth;
162
        }
163
        
164
        /**
165
         * Obtiene la etiqueta con el valor alto
166
         * @return
167
         */
168
        public JLabel getLHeight(){
169
                return this.lHeight;
170
        }
171
}