gvsig-vectorediting / org.gvsig.vectorediting / trunk / org.gvsig.vectorediting / org.gvsig.vectorediting.swing / org.gvsig.vectorediting.swing.impl / src / main / java / org / gvsig / vectorediting / swing / impl / contextmenu / EditingPointPanelView.java @ 1575
History | View | Annotate | Download (4.02 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright ? 2007-2014 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 2
|
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 |
|
25 |
package org.gvsig.vectorediting.swing.impl.contextmenu; |
26 |
|
27 |
import java.awt.Component; |
28 |
import java.awt.GridBagConstraints; |
29 |
import java.awt.GridBagLayout; |
30 |
import java.awt.Insets; |
31 |
|
32 |
import javax.swing.JLabel; |
33 |
import javax.swing.JPanel; |
34 |
import javax.swing.JTextField; |
35 |
|
36 |
/**
|
37 |
* @author llmarques
|
38 |
*
|
39 |
*/
|
40 |
public class EditingPointPanelView extends JPanel { |
41 |
|
42 |
private static final long serialVersionUID = 941157096517987833L; |
43 |
|
44 |
private JTextField yTextfield; |
45 |
|
46 |
private JLabel yLabel; |
47 |
|
48 |
private JTextField xTextField; |
49 |
|
50 |
private JLabel xLabel; |
51 |
|
52 |
public EditingPointPanelView() {
|
53 |
super();
|
54 |
|
55 |
initialize(); |
56 |
|
57 |
// addHierarchyChanged();
|
58 |
} |
59 |
|
60 |
// /**
|
61 |
// * Adds an hierarchy listener to value text field. The purpose of this is
|
62 |
// * request focus when texfield ancestor gains focus.
|
63 |
// */
|
64 |
// private void addHierarchyChanged() {
|
65 |
// getXTextField().addHierarchyListener(new DefaultHierarchyListener());
|
66 |
// }
|
67 |
|
68 |
private void initialize() { |
69 |
setLayout(new GridBagLayout()); |
70 |
|
71 |
GridBagConstraints constrains = new GridBagConstraints(); |
72 |
constrains.gridx = GridBagConstraints.RELATIVE;
|
73 |
constrains.gridy = 1;
|
74 |
constrains.weightx = 0;
|
75 |
constrains.weighty = 0;
|
76 |
constrains.insets = new Insets(5, 5, 5, 5); |
77 |
constrains.anchor = GridBagConstraints.WEST;
|
78 |
|
79 |
add(getXLabel(), constrains); |
80 |
|
81 |
constrains = new GridBagConstraints(); |
82 |
constrains.gridx = GridBagConstraints.RELATIVE;
|
83 |
constrains.gridy = 1;
|
84 |
constrains.weightx = 1;
|
85 |
constrains.weighty = 0;
|
86 |
constrains.fill = GridBagConstraints.HORIZONTAL;
|
87 |
constrains.insets = new Insets(5, 5, 5, 5); |
88 |
constrains.anchor = GridBagConstraints.EAST;
|
89 |
|
90 |
add(getXTextField(), constrains); |
91 |
|
92 |
constrains = new GridBagConstraints(); |
93 |
constrains.gridx = GridBagConstraints.RELATIVE;
|
94 |
constrains.gridy = 2;
|
95 |
constrains.weightx = 0;
|
96 |
constrains.weighty = 0;
|
97 |
constrains.insets = new Insets(5, 5, 5, 5); |
98 |
constrains.anchor = GridBagConstraints.WEST;
|
99 |
|
100 |
add(getYLabel(), constrains); |
101 |
|
102 |
constrains = new GridBagConstraints(); |
103 |
constrains.gridx = GridBagConstraints.RELATIVE;
|
104 |
constrains.gridy = 2;
|
105 |
constrains.weightx = 1;
|
106 |
constrains.weighty = 0;
|
107 |
constrains.fill = GridBagConstraints.HORIZONTAL;
|
108 |
constrains.insets = new Insets(5, 5, 5, 5); |
109 |
constrains.anchor = GridBagConstraints.EAST;
|
110 |
|
111 |
add(getYTextField(), constrains); |
112 |
|
113 |
} |
114 |
|
115 |
protected JTextField getYTextField() { |
116 |
if (yTextfield == null) { |
117 |
yTextfield = new JTextField(); |
118 |
} |
119 |
return yTextfield;
|
120 |
} |
121 |
|
122 |
private JLabel getYLabel() { |
123 |
if (yLabel == null) { |
124 |
yLabel = new JLabel("Y"); |
125 |
} |
126 |
return yLabel;
|
127 |
} |
128 |
|
129 |
protected JTextField getXTextField() { |
130 |
if (xTextField == null) { |
131 |
xTextField = new JTextField(); |
132 |
} |
133 |
return xTextField;
|
134 |
} |
135 |
|
136 |
private Component getXLabel() { |
137 |
if (xLabel == null) { |
138 |
xLabel = new JLabel("X"); |
139 |
} |
140 |
return xLabel;
|
141 |
} |
142 |
|
143 |
} |