Revision 123
org.gvsig.educa.batovi/trunk/org.gvsig.educa.batovi.mapviewer/org.gvsig.educa.batovi.mapviewer/src/main/java/org/gvsig/educa/batovi/mapviewer/tools/StatusBarBehavior.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
package org.gvsig.educa.batovi.mapviewer.tools; |
|
23 |
|
|
24 |
import java.awt.event.MouseEvent; |
|
25 |
import java.text.NumberFormat; |
|
26 |
|
|
27 |
import org.cresques.cts.IProjection; |
|
28 |
|
|
29 |
import org.gvsig.educa.batovi.mapviewer.StatusBar; |
|
30 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
31 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
32 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
|
33 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
|
34 |
import org.gvsig.fmap.mapcontext.events.ProjectionEvent; |
|
35 |
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener; |
|
36 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
37 |
import org.gvsig.fmap.mapcontrol.MapControlDrawer; |
|
38 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
|
39 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
|
40 |
import org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener; |
|
41 |
|
|
42 |
/** |
|
43 |
* Map Tool Behavior which shows information in status bar |
|
44 |
* |
|
45 |
* @author gvSIG Team |
|
46 |
* @version $Id$ |
|
47 |
* |
|
48 |
*/ |
|
49 |
/** |
|
50 |
* @author gvSIG Team |
|
51 |
* @version $Id$ |
|
52 |
* |
|
53 |
*/ |
|
54 |
public class StatusBarBehavior extends Behavior implements ViewPortListener { |
|
55 |
|
|
56 |
private StatusBar statusBar = null; |
|
57 |
private String distanceName; |
|
58 |
private boolean isDegrees; |
|
59 |
private final NumberFormat decimalFormater; |
|
60 |
private final NumberFormat scaleFormater; |
|
61 |
|
|
62 |
/** |
|
63 |
* |
|
64 |
*/ |
|
65 |
public StatusBarBehavior() { |
|
66 |
decimalFormater = NumberFormat.getInstance(); |
|
67 |
decimalFormater.setMaximumFractionDigits(2); |
|
68 |
decimalFormater.setMinimumFractionDigits(2); |
|
69 |
scaleFormater = NumberFormat.getInstance(); |
|
70 |
scaleFormater.setMaximumFractionDigits(0); |
|
71 |
} |
|
72 |
|
|
73 |
@Override |
|
74 |
public ToolListener getListener() { |
|
75 |
return null; |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
79 |
public void paintComponent(MapControlDrawer mapControlDrawer) { |
|
80 |
// Do nothing |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* Link behavior to the status bar to update |
|
85 |
* |
|
86 |
* @param statusBar |
|
87 |
*/ |
|
88 |
public void setStatusBar(StatusBar statusBar) { |
|
89 |
this.statusBar = statusBar; |
|
90 |
} |
|
91 |
|
|
92 |
@Override |
|
93 |
public void setMapControl(MapControl mc) { |
|
94 |
MapControl prev = getMapControl(); |
|
95 |
if (prev != null) { |
|
96 |
// remove from previous view port listener (just one map can be |
|
97 |
// show) |
|
98 |
prev.getViewPort().removeViewPortListener(this); |
|
99 |
} |
|
100 |
super.setMapControl(mc); |
|
101 |
if (statusBar != null) { |
|
102 |
updateCRS(); |
|
103 |
updateScale(); |
|
104 |
statusBar.setX(""); |
|
105 |
statusBar.setY(""); |
|
106 |
} |
|
107 |
// add as listener to receive notifications about scale and crs changes |
|
108 |
mc.getViewPort().addViewPortListener(this); |
|
109 |
} |
|
110 |
|
|
111 |
@Override |
|
112 |
public void mouseMoved(MouseEvent e) throws BehaviorException { |
|
113 |
if (statusBar == null) { |
|
114 |
// Nothing to do |
|
115 |
return; |
|
116 |
} |
|
117 |
// Transform mapControl pixel to real world point |
|
118 |
org.gvsig.fmap.geom.primitive.Point mapPoint = |
|
119 |
getMapControl().getViewPort().convertToMapPoint(e.getPoint()); |
|
120 |
if (isDegrees) { |
|
121 |
statusBar.setX(formatDegrees(mapPoint.getX())); |
|
122 |
statusBar.setY(formatDegrees(mapPoint.getY())); |
|
123 |
} else { |
|
124 |
statusBar.setX(decimalFormater.format(mapPoint.getX())); |
|
125 |
statusBar.setY(decimalFormater.format(mapPoint.getY())); |
|
126 |
} |
|
127 |
} |
|
128 |
|
|
129 |
/** |
|
130 |
* Update scale value |
|
131 |
* |
|
132 |
*/ |
|
133 |
private void updateScale() { |
|
134 |
statusBar.setScale(scaleFormater.format(getMapControl().getMapContext() |
|
135 |
.getScaleView())); |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* Update CRS value and coordinate labels (depending on coordinate type is |
|
140 |
* degree or UTM) |
|
141 |
*/ |
|
142 |
private void updateCRS() { |
|
143 |
MapContext mc = getMapControl().getMapContext(); |
|
144 |
IProjection iProj = mc.getProjection(); |
|
145 |
ViewPort vp = mc.getViewPort(); |
|
146 |
distanceName = MapContext.getDistanceNames()[vp.getDistanceUnits()]; |
|
147 |
isDegrees = !iProj.isProjected() || distanceName.equals("Grados"); |
|
148 |
if (isDegrees) { |
|
149 |
statusBar.setXLabel("Lon ="); |
|
150 |
statusBar.setYLabel("Lat ="); |
|
151 |
} else { |
|
152 |
statusBar.setXLabel("X = "); |
|
153 |
statusBar.setYLabel("Y = "); |
|
154 |
} |
|
155 |
statusBar.setCRS(iProj.getAbrev()); |
|
156 |
} |
|
157 |
|
|
158 |
/** |
|
159 |
* <p> |
|
160 |
* Converts a decimal value (expected latitude or longitude) in degrees, and |
|
161 |
* formats it according this pattern:<br> |
|
162 |
* <code><b><i>S?G? M' S''</i></b></code>, having:<br> |
|
163 |
* <ul> |
|
164 |
* <li><i>S?</i> : optionally, if the value is negative, sets a "-" symbol.</li> |
|
165 |
* <li><i>G</i> : equivalent grades.</li> |
|
166 |
* <li><i>M</i> : equivalent minutes.</li> |
|
167 |
* <li><i>S</i> : equivalent seconds.</li> |
|
168 |
* </ul> |
|
169 |
* </p> |
|
170 |
* |
|
171 |
* @param d |
|
172 |
* the latitude or longitude value to convert |
|
173 |
* |
|
174 |
* @return value formatted in degrees |
|
175 |
*/ |
|
176 |
private String formatDegrees(double d) { |
|
177 |
String signo = d < 0 ? "-" : ""; |
|
178 |
d = Math.abs(d); |
|
179 |
long grado = 0; |
|
180 |
double minuto = 0; |
|
181 |
double segundo = 0; |
|
182 |
|
|
183 |
grado = (long) (d); |
|
184 |
minuto = (d - grado) * 60; |
|
185 |
segundo = (minuto - (long) minuto) * 60; |
|
186 |
// System.out.println("Grados: " + grado); |
|
187 |
// System.out.println("Minutos: " + minuto); |
|
188 |
// System.out.println("Segundos: " + segundo); |
|
189 |
return signo + grado + "? " + (long) minuto + "' " + (long) segundo |
|
190 |
+ "''"; |
|
191 |
} |
|
192 |
|
|
193 |
public void extentChanged(ExtentEvent e) { |
|
194 |
if (statusBar == null) { |
|
195 |
return; |
|
196 |
} |
|
197 |
updateScale(); |
|
198 |
} |
|
199 |
|
|
200 |
public void backColorChanged(ColorEvent e) { |
|
201 |
// Do nothing |
|
202 |
} |
|
203 |
|
|
204 |
public void projectionChanged(ProjectionEvent e) { |
|
205 |
if (statusBar == null) { |
|
206 |
return; |
|
207 |
} |
|
208 |
updateCRS(); |
|
209 |
updateScale(); |
|
210 |
} |
|
211 |
} |
org.gvsig.educa.batovi/trunk/org.gvsig.educa.batovi.mapviewer/org.gvsig.educa.batovi.mapviewer/src/main/java/org/gvsig/educa/batovi/mapviewer/MapToolsRegistrant.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.educa.batovi.mapviewer; |
23 | 23 |
|
24 |
import org.gvsig.educa.batovi.mapviewer.tools.StatusBarBehavior; |
|
24 | 25 |
import org.gvsig.educa.thematicmap.swing.viewer.MapControlToolRegistrant; |
25 | 26 |
import org.gvsig.fmap.mapcontrol.MapControl; |
27 |
import org.gvsig.fmap.mapcontrol.tools.CompoundBehavior; |
|
26 | 28 |
import org.gvsig.fmap.mapcontrol.tools.PanListenerImpl; |
27 | 29 |
import org.gvsig.fmap.mapcontrol.tools.ZoomInListenerImpl; |
28 | 30 |
import org.gvsig.fmap.mapcontrol.tools.ZoomOutRightButtonListener; |
... | ... | |
43 | 45 |
|
44 | 46 |
public static final String TOOL_PAN_ID = "pan"; |
45 | 47 |
|
48 |
private final StatusBarBehavior statusBarBehavior = new StatusBarBehavior(); |
|
49 |
private final MouseWheelBehavior mouseWheelBehavior = |
|
50 |
new MouseWheelBehavior(); |
|
51 |
private final CompoundBehavior compoundBehavior = new CompoundBehavior( |
|
52 |
new Behavior[] { mouseWheelBehavior, statusBarBehavior }); |
|
53 |
|
|
46 | 54 |
public void registerTools(MapControl mapControl) { |
47 | 55 |
// Adds tools to mapControl |
48 | 56 |
// mouseWhell |
49 |
mapControl.addCombinedBehavior(new MouseWheelBehavior());
|
|
57 |
mapControl.addCombinedBehavior(compoundBehavior);
|
|
50 | 58 |
// zoom |
51 | 59 |
mapControl.addBehavior(TOOL_ZOOM_ID, new Behavior[] { |
52 | 60 |
new RectangleBehavior(new ZoomInListenerImpl(mapControl)), |
... | ... | |
58 | 66 |
mapControl.setTool(TOOL_PAN_ID); |
59 | 67 |
} |
60 | 68 |
|
69 |
/** |
|
70 |
* |
|
71 |
*/ |
|
72 |
public void setStatusBar(StatusBar statusBar) { |
|
73 |
this.statusBarBehavior.setStatusBar(statusBar); |
|
74 |
} |
|
75 |
|
|
61 | 76 |
} |
org.gvsig.educa.batovi/trunk/org.gvsig.educa.batovi.mapviewer/org.gvsig.educa.batovi.mapviewer/src/main/java/org/gvsig/educa/batovi/mapviewer/Main.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import java.awt.BorderLayout; |
25 | 25 |
import java.awt.Dimension; |
26 |
import java.awt.Toolkit; |
|
26 | 27 |
import java.awt.event.ActionEvent; |
27 | 28 |
import java.io.File; |
28 | 29 |
import java.io.IOException; |
... | ... | |
38 | 39 |
import javax.swing.JMenuBar; |
39 | 40 |
import javax.swing.JMenuItem; |
40 | 41 |
import javax.swing.JToolBar; |
42 |
import javax.swing.SwingUtilities; |
|
43 |
import javax.swing.UIManager; |
|
41 | 44 |
import javax.swing.WindowConstants; |
42 | 45 |
|
43 | 46 |
import org.slf4j.Logger; |
... | ... | |
108 | 111 |
|
109 | 112 |
private AbstractAction addInstallUrl; |
110 | 113 |
|
114 |
private final MapToolsRegistrant mapToolsRegistrant; |
|
115 |
|
|
116 |
private StatusBar statusBar; |
|
117 |
|
|
111 | 118 |
public static void main(String args[]) { |
112 | 119 |
new DefaultLibrariesInitializer().fullInitialize(); |
113 | 120 |
|
... | ... | |
132 | 139 |
File defaultFolder = |
133 | 140 |
new File(System.getProperty("user.home"), defaultFolderPath); |
134 | 141 |
|
135 |
if (defaultFolder.exists() && defaultFolder.isDirectory()) {
|
|
136 |
manager.setInstallationMapFolder(defaultFolder.getAbsolutePath());
|
|
142 |
if (!defaultFolder.exists()) {
|
|
143 |
defaultFolder.mkdirs();
|
|
137 | 144 |
} |
145 |
manager.setInstallationMapFolder(defaultFolder.getAbsolutePath()); |
|
138 | 146 |
|
139 |
swingManager.addMapControlRegistrant(new MapToolsRegistrant()); |
|
147 |
mapToolsRegistrant = new MapToolsRegistrant(); |
|
148 |
swingManager.addMapControlRegistrant(mapToolsRegistrant); |
|
140 | 149 |
|
141 | 150 |
fileChooser = new JFileChooser(); |
142 | 151 |
|
152 |
try { |
|
153 |
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
|
154 |
} catch (Exception ex) { |
|
155 |
LOG.error("Exception setting system LookAndFeel: ".concat(UIManager |
|
156 |
.getSystemLookAndFeelClassName()), ex); |
|
157 |
throw new RuntimeException(ex); |
|
158 |
} |
|
159 |
|
|
143 | 160 |
} |
144 | 161 |
|
145 | 162 |
/** |
... | ... | |
151 | 168 |
createActions(); |
152 | 169 |
|
153 | 170 |
// Create JFrame to show data |
154 |
mainFrame = new JFrame("ThematicMap example app"); |
|
171 |
mainFrame = new JFrame("gvSIG Batovi Map Viewer"); |
|
172 |
mainFrame.setUndecorated(true); |
|
155 | 173 |
mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); |
156 | 174 |
mainFrame.setLayout(new BorderLayout(10, 10)); |
157 | 175 |
|
158 | 176 |
// Create menu bar |
159 |
createMenu(); |
|
177 |
// createMenu();
|
|
160 | 178 |
|
161 | 179 |
// Create tools bar |
162 | 180 |
createToolBar(); |
163 | 181 |
|
182 |
// Create status bar |
|
183 |
createStatusBar(); |
|
184 |
|
|
164 | 185 |
updateControls(); |
165 | 186 |
|
166 | 187 |
// Display the window. |
167 | 188 |
mainFrame.pack(); |
168 |
mainFrame.setSize(800, 600); |
|
189 |
Toolkit toolkit = Toolkit.getDefaultToolkit(); |
|
190 |
Dimension dimension = toolkit.getScreenSize(); |
|
191 |
mainFrame.setSize(dimension); |
|
192 |
mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); |
|
193 |
mainFrame.setLocation(0, 0); |
|
169 | 194 |
mainFrame.setVisible(true); |
170 | 195 |
|
171 | 196 |
} |
... | ... | |
325 | 350 |
} |
326 | 351 |
|
327 | 352 |
/** |
353 |
* Creates the tools bar |
|
354 |
*/ |
|
355 |
private void createStatusBar() { |
|
356 |
// TODO look at gvSIG status bar |
|
357 |
Dimension sepSize = new Dimension(20, 5); |
|
358 |
statusBar = new StatusBar(); |
|
359 |
mapToolsRegistrant.setStatusBar(statusBar); |
|
360 |
mainFrame.add(statusBar, BorderLayout.PAGE_END); |
|
361 |
} |
|
362 |
|
|
363 |
/** |
|
328 | 364 |
* Shows file chooser to select thematic map folder |
329 | 365 |
*/ |
330 | 366 |
public void setThematicMapFolder() { |
... | ... | |
411 | 447 |
public void closeMap() { |
412 | 448 |
doCloseMap(); |
413 | 449 |
updateControls(); |
450 |
SwingUtilities.invokeLater(new Runnable() { |
|
451 |
|
|
452 |
public void run() { |
|
453 |
mainFrame.repaint(); |
|
454 |
} |
|
455 |
}); |
|
414 | 456 |
} |
415 | 457 |
|
416 | 458 |
/** |
... | ... | |
424 | 466 |
} catch (IOException e) { |
425 | 467 |
LOG.warn("Exception clossing map", e); |
426 | 468 |
} |
469 |
statusBar.clear(); |
|
427 | 470 |
curViewer = null; |
428 | 471 |
} |
429 | 472 |
} |
org.gvsig.educa.batovi/trunk/org.gvsig.educa.batovi.mapviewer/org.gvsig.educa.batovi.mapviewer/src/main/java/org/gvsig/educa/batovi/mapviewer/StatusBar.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
package org.gvsig.educa.batovi.mapviewer; |
|
23 |
|
|
24 |
import java.awt.Dimension; |
|
25 |
|
|
26 |
import javax.swing.Box; |
|
27 |
import javax.swing.JLabel; |
|
28 |
import javax.swing.JToolBar; |
|
29 |
|
|
30 |
/** |
|
31 |
* Status bar widget |
|
32 |
* |
|
33 |
* @author gvSIG Team |
|
34 |
* @version $Id$ |
|
35 |
* |
|
36 |
*/ |
|
37 |
public class StatusBar extends JToolBar { |
|
38 |
|
|
39 |
/** |
|
40 |
* |
|
41 |
*/ |
|
42 |
private static final long serialVersionUID = -6785797381430943587L; |
|
43 |
private JLabel labelX; |
|
44 |
private JLabel x; |
|
45 |
private JLabel labelY; |
|
46 |
private JLabel y; |
|
47 |
private JLabel crs; |
|
48 |
private JLabel scale; |
|
49 |
private JLabel info; |
|
50 |
|
|
51 |
/** |
|
52 |
* |
|
53 |
*/ |
|
54 |
public StatusBar() { |
|
55 |
super(); |
|
56 |
initControls(); |
|
57 |
} |
|
58 |
|
|
59 |
private void initControls() { |
|
60 |
Dimension minLableSize = new Dimension(30, 20); |
|
61 |
labelX = new JLabel(); |
|
62 |
labelX.setMinimumSize(minLableSize); |
|
63 |
add(labelX); |
|
64 |
|
|
65 |
x = new JLabel(); |
|
66 |
x.setMinimumSize(minLableSize); |
|
67 |
add(x); |
|
68 |
|
|
69 |
add(Box.createHorizontalStrut(18)); |
|
70 |
|
|
71 |
labelY = new JLabel(); |
|
72 |
labelY.setMinimumSize(minLableSize); |
|
73 |
add(labelY); |
|
74 |
|
|
75 |
y = new JLabel(); |
|
76 |
y.setMinimumSize(minLableSize); |
|
77 |
add(y); |
|
78 |
|
|
79 |
add(Box.createHorizontalStrut(52)); |
|
80 |
add(new JLabel("CRS:")); |
|
81 |
crs = new JLabel(); |
|
82 |
crs.setMinimumSize(minLableSize); |
|
83 |
add(crs); |
|
84 |
|
|
85 |
add(Box.createHorizontalStrut(52)); |
|
86 |
add(new JLabel("Scale 1:")); |
|
87 |
scale = new JLabel(); |
|
88 |
scale.setMinimumSize(minLableSize); |
|
89 |
add(scale); |
|
90 |
|
|
91 |
add(Box.createHorizontalStrut(18)); |
|
92 |
|
|
93 |
add(Box.createGlue()); |
|
94 |
|
|
95 |
info = new JLabel(); |
|
96 |
add(info); |
|
97 |
|
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* Update additional informations |
|
102 |
* |
|
103 |
* @param string |
|
104 |
*/ |
|
105 |
public void setInfo(String string) { |
|
106 |
info.setText(string); |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* Sets current X coordinate value |
|
111 |
* |
|
112 |
* @param x |
|
113 |
*/ |
|
114 |
public void setX(String x) { |
|
115 |
this.x.setText(x); |
|
116 |
} |
|
117 |
|
|
118 |
/** |
|
119 |
* Sets current Y coordinate value |
|
120 |
* |
|
121 |
* @param y |
|
122 |
*/ |
|
123 |
public void setY(String y) { |
|
124 |
this.y.setText(y); |
|
125 |
} |
|
126 |
|
|
127 |
/** |
|
128 |
* Sets current CRS name |
|
129 |
* |
|
130 |
* @param crs |
|
131 |
*/ |
|
132 |
public void setCRS(String crs) { |
|
133 |
this.crs.setText(crs); |
|
134 |
} |
|
135 |
|
|
136 |
/** |
|
137 |
* Sets current scale value |
|
138 |
* |
|
139 |
* @param scale |
|
140 |
*/ |
|
141 |
public void setScale(String scale) { |
|
142 |
this.scale.setText(scale); |
|
143 |
} |
|
144 |
|
|
145 |
/** |
|
146 |
* Sets X coordinate label |
|
147 |
* |
|
148 |
* @param string |
|
149 |
*/ |
|
150 |
public void setXLabel(String string) { |
|
151 |
labelX.setText(string); |
|
152 |
} |
|
153 |
|
|
154 |
/** |
|
155 |
* Sets Y coordinate label |
|
156 |
* |
|
157 |
* @param string |
|
158 |
*/ |
|
159 |
public void setYLabel(String string) { |
|
160 |
labelY.setText(string); |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* |
|
165 |
*/ |
|
166 |
public void clear() { |
|
167 |
x.setText(""); |
|
168 |
y.setText(""); |
|
169 |
labelX.setText(""); |
|
170 |
labelY.setText(""); |
|
171 |
scale.setText(""); |
|
172 |
crs.setText(""); |
|
173 |
} |
|
174 |
} |
org.gvsig.educa.batovi/trunk/org.gvsig.educa.batovi.mapviewer/org.gvsig.educa.batovi.mapviewer/src/main/java/org/gvsig/educa/batovi/mapviewer/OpenThematicMap.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import java.awt.BorderLayout; |
25 | 25 |
import java.awt.Dimension; |
26 |
import java.awt.Toolkit; |
|
26 | 27 |
import java.awt.event.ActionEvent; |
27 | 28 |
import java.util.ArrayList; |
28 | 29 |
import java.util.List; |
... | ... | |
113 | 114 |
*/ |
114 | 115 |
private void initializeUI() { |
115 | 116 |
setLayout(new BorderLayout(5, 5)); |
117 |
// Gets screen size |
|
118 |
Toolkit toolkit = Toolkit.getDefaultToolkit(); |
|
119 |
Dimension sSize = toolkit.getScreenSize(); |
|
116 | 120 |
|
117 |
setMaximumSize(new Dimension(300, 200)); |
|
118 |
setPreferredSize(new Dimension(800, 600)); |
|
121 |
// Subtract a 10% |
|
122 |
Dimension screenSize = |
|
123 |
new Dimension(sSize.width - (sSize.width / 10), sSize.height |
|
124 |
- (sSize.height / 10)); |
|
119 | 125 |
|
126 |
setMinimumSize(new Dimension(300, 200)); |
|
127 |
setPreferredSize(screenSize); |
|
128 |
|
|
120 | 129 |
list = new JList(mapNames.toArray()); |
121 | 130 |
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
122 | 131 |
list.addListSelectionListener(this); |
123 | 132 |
Also available in: Unified diff