root / trunk / libraries / libUIComponent / src / org / gvsig / gui / beans / graphic / BoxesPanel.java @ 11004
History | View | Annotate | Download (3.47 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 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.gui.beans.graphic; |
20 |
|
21 |
import java.awt.BorderLayout; |
22 |
import java.awt.FlowLayout; |
23 |
|
24 |
import javax.swing.JPanel; |
25 |
|
26 |
import org.gvsig.gui.beans.textincreaser.TextIncreaserContainer; |
27 |
|
28 |
/**
|
29 |
*
|
30 |
* Nacho Brodin (brodin_ign@gva.es)
|
31 |
*/
|
32 |
|
33 |
public class BoxesPanel extends JPanel { |
34 |
private static final long serialVersionUID = -4117483555280497312L; |
35 |
private JPanel pLeft = null; |
36 |
private JPanel pRight = null; |
37 |
private TextIncreaserContainer controlLeft = null; |
38 |
private TextIncreaserContainer controlRight = null; |
39 |
public BoxesPanel() {
|
40 |
super();
|
41 |
initialize(); |
42 |
} |
43 |
|
44 |
/**
|
45 |
* This method initializes this
|
46 |
*
|
47 |
*/
|
48 |
private void initialize() { |
49 |
this.setLayout(new BorderLayout()); |
50 |
this.add(getPLeft(), BorderLayout.WEST); |
51 |
this.add(getPRight(), BorderLayout.EAST); |
52 |
} |
53 |
|
54 |
/**
|
55 |
* This method initializes jPanel
|
56 |
*
|
57 |
* @return javax.swing.JPanel
|
58 |
*/
|
59 |
private JPanel getPLeft() { |
60 |
if (pLeft == null) { |
61 |
FlowLayout flowLayout1 = new FlowLayout(); |
62 |
flowLayout1.setHgap(0);
|
63 |
flowLayout1.setAlignment(java.awt.FlowLayout.LEFT); |
64 |
flowLayout1.setVgap(0);
|
65 |
pLeft = new JPanel(); |
66 |
pLeft.setLayout(flowLayout1); |
67 |
pLeft.add(getControlLeft(), null);
|
68 |
pLeft.setPreferredSize(new java.awt.Dimension(100, 30)); |
69 |
} |
70 |
return pLeft;
|
71 |
} |
72 |
|
73 |
/**
|
74 |
* This method initializes jPanel1
|
75 |
*
|
76 |
* @return javax.swing.JPanel
|
77 |
*/
|
78 |
private JPanel getPRight() { |
79 |
if (pRight == null) { |
80 |
FlowLayout flowLayout2 = new FlowLayout(); |
81 |
flowLayout2.setHgap(0);
|
82 |
flowLayout2.setAlignment(java.awt.FlowLayout.RIGHT); |
83 |
flowLayout2.setVgap(0);
|
84 |
pRight = new JPanel(); |
85 |
pRight.setLayout(flowLayout2); |
86 |
pRight.add(getControlRight(), null);
|
87 |
pRight.setPreferredSize(new java.awt.Dimension(100, 30)); |
88 |
} |
89 |
return pRight;
|
90 |
} |
91 |
|
92 |
/**
|
93 |
* This method initializes jPanel
|
94 |
*
|
95 |
* @return javax.swing.JPanel
|
96 |
*/
|
97 |
public TextIncreaserContainer getControlLeft() {
|
98 |
if (controlLeft == null) { |
99 |
controlLeft = new TextIncreaserContainer(70, 0, 100, 0.0, true); |
100 |
} |
101 |
return controlLeft;
|
102 |
} |
103 |
|
104 |
/**
|
105 |
* This method initializes jPanel1
|
106 |
*
|
107 |
* @return javax.swing.JPanel
|
108 |
*/
|
109 |
public TextIncreaserContainer getControlRight() {
|
110 |
if (controlRight == null) { |
111 |
controlRight = new TextIncreaserContainer(70, 0, 100, 100.0, false); |
112 |
} |
113 |
return controlRight;
|
114 |
} |
115 |
|
116 |
//****************************************************
|
117 |
//M?TODOS DEL CONTROL
|
118 |
|
119 |
/**
|
120 |
* Obtiene el valor de los controles.
|
121 |
* @return Array con los valores de ambos controles. El primer valor del array es el control de la derecha
|
122 |
* y el segundo el de la izquierda.
|
123 |
*/
|
124 |
public double[] getBoxesValues(){ |
125 |
double[] v = new double[2]; |
126 |
v[0] = getControlRight().getValue();
|
127 |
v[1] = getControlLeft().getValue();
|
128 |
return v;
|
129 |
} |
130 |
} |