svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / main / java / org / gvsig / gui / beans / graphic / BoxesPanel.java @ 40561
History | View | Annotate | Download (3.54 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.gui.beans.graphic; |
25 |
|
26 |
import java.awt.BorderLayout; |
27 |
import java.awt.Dimension; |
28 |
import java.awt.FlowLayout; |
29 |
|
30 |
import javax.swing.JPanel; |
31 |
|
32 |
import org.gvsig.gui.beans.textincreaser.TextIncreaserContainer; |
33 |
|
34 |
/**
|
35 |
*
|
36 |
* Nacho Brodin (brodin_ign@gva.es)
|
37 |
*/
|
38 |
|
39 |
public class BoxesPanel extends JPanel { |
40 |
private static final long serialVersionUID = -4117483555280497312L; |
41 |
private JPanel pLeft = null; |
42 |
private JPanel pRight = null; |
43 |
private TextIncreaserContainer controlLeft = null; |
44 |
private TextIncreaserContainer controlRight = null; |
45 |
public BoxesPanel() {
|
46 |
super();
|
47 |
initialize(); |
48 |
} |
49 |
|
50 |
/**
|
51 |
* This method initializes this
|
52 |
*
|
53 |
*/
|
54 |
private void initialize() { |
55 |
this.setLayout(new BorderLayout()); |
56 |
this.add(getPLeft(), BorderLayout.WEST); |
57 |
this.add(getPRight(), BorderLayout.EAST); |
58 |
} |
59 |
|
60 |
/**
|
61 |
* This method initializes jPanel
|
62 |
*
|
63 |
* @return javax.swing.JPanel
|
64 |
*/
|
65 |
private JPanel getPLeft() { |
66 |
if (pLeft == null) { |
67 |
FlowLayout flowLayout1 = new FlowLayout(); |
68 |
flowLayout1.setHgap(0);
|
69 |
flowLayout1.setAlignment(FlowLayout.LEFT);
|
70 |
flowLayout1.setVgap(0);
|
71 |
pLeft = new JPanel(); |
72 |
pLeft.setLayout(flowLayout1); |
73 |
pLeft.add(getControlLeft(), null);
|
74 |
pLeft.setPreferredSize(new Dimension(100, 30)); |
75 |
} |
76 |
return pLeft;
|
77 |
} |
78 |
|
79 |
/**
|
80 |
* This method initializes jPanel1
|
81 |
*
|
82 |
* @return javax.swing.JPanel
|
83 |
*/
|
84 |
private JPanel getPRight() { |
85 |
if (pRight == null) { |
86 |
FlowLayout flowLayout2 = new FlowLayout(); |
87 |
flowLayout2.setHgap(0);
|
88 |
flowLayout2.setAlignment(FlowLayout.RIGHT);
|
89 |
flowLayout2.setVgap(0);
|
90 |
pRight = new JPanel(); |
91 |
pRight.setLayout(flowLayout2); |
92 |
pRight.add(getControlRight(), null);
|
93 |
pRight.setPreferredSize(new Dimension(100, 30)); |
94 |
} |
95 |
return pRight;
|
96 |
} |
97 |
|
98 |
/**
|
99 |
* This method initializes jPanel
|
100 |
*
|
101 |
* @return javax.swing.JPanel
|
102 |
*/
|
103 |
public TextIncreaserContainer getControlLeft() {
|
104 |
if (controlLeft == null) { |
105 |
controlLeft = new TextIncreaserContainer(70, 0, 100, 0.0, true); |
106 |
} |
107 |
return controlLeft;
|
108 |
} |
109 |
|
110 |
/**
|
111 |
* This method initializes jPanel1
|
112 |
*
|
113 |
* @return javax.swing.JPanel
|
114 |
*/
|
115 |
public TextIncreaserContainer getControlRight() {
|
116 |
if (controlRight == null) { |
117 |
controlRight = new TextIncreaserContainer(70, 0, 100, 100.0, false); |
118 |
} |
119 |
return controlRight;
|
120 |
} |
121 |
|
122 |
//****************************************************
|
123 |
//M?TODOS DEL CONTROL
|
124 |
|
125 |
/**
|
126 |
* Obtiene el valor de los controles.
|
127 |
* @return Array con los valores de ambos controles. El primer valor del array es el control de la derecha
|
128 |
* y el segundo el de la izquierda.
|
129 |
*/
|
130 |
public double[] getBoxesValues(){ |
131 |
double[] v = new double[2]; |
132 |
v[0] = getControlRight().getValue();
|
133 |
v[1] = getControlLeft().getValue();
|
134 |
return v;
|
135 |
} |
136 |
} |