root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / fframes / dialogs / FFrameScaleBarDialog.java @ 6117
History | View | Annotate | Download (31.8 KB)
1 | 312 | fernando | /*
|
---|---|---|---|
2 | * Created on 02-jun-2004
|
||
3 | *
|
||
4 | */
|
||
5 | 1103 | fjp | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
6 | *
|
||
7 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
8 | *
|
||
9 | * This program is free software; you can redistribute it and/or
|
||
10 | * modify it under the terms of the GNU General Public License
|
||
11 | * as published by the Free Software Foundation; either version 2
|
||
12 | * of the License, or (at your option) any later version.
|
||
13 | *
|
||
14 | * This program is distributed in the hope that it will be useful,
|
||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
17 | * GNU General Public License for more details.
|
||
18 | *
|
||
19 | * You should have received a copy of the GNU General Public License
|
||
20 | * along with this program; if not, write to the Free Software
|
||
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
22 | *
|
||
23 | * For more information, contact:
|
||
24 | *
|
||
25 | * Generalitat Valenciana
|
||
26 | * Conselleria d'Infraestructures i Transport
|
||
27 | * Av. Blasco Ib??ez, 50
|
||
28 | * 46010 VALENCIA
|
||
29 | * SPAIN
|
||
30 | *
|
||
31 | * +34 963862235
|
||
32 | * gvsig@gva.es
|
||
33 | * www.gvsig.gva.es
|
||
34 | *
|
||
35 | * or
|
||
36 | *
|
||
37 | * IVER T.I. S.A
|
||
38 | * Salamanca 50
|
||
39 | * 46005 Valencia
|
||
40 | * Spain
|
||
41 | *
|
||
42 | * +34 963163400
|
||
43 | * dac@iver.es
|
||
44 | */
|
||
45 | 312 | fernando | package com.iver.cit.gvsig.gui.layout.fframes.dialogs; |
46 | |||
47 | 1074 | vcaballero | import com.iver.andami.PluginServices; |
48 | import com.iver.andami.ui.mdiManager.ViewInfo; |
||
49 | |||
50 | 2268 | fjp | import com.iver.cit.gvsig.AddLayer; |
51 | 6117 | jaume | import com.iver.cit.gvsig.gui.dialogs.FontChooser; |
52 | 1074 | vcaballero | import com.iver.cit.gvsig.gui.layout.Attributes; |
53 | import com.iver.cit.gvsig.gui.layout.FLayoutUtilities; |
||
54 | import com.iver.cit.gvsig.gui.layout.Layout; |
||
55 | import com.iver.cit.gvsig.gui.layout.fframes.FFrameScaleBar; |
||
56 | import com.iver.cit.gvsig.gui.layout.fframes.FFrameView; |
||
57 | import com.iver.cit.gvsig.gui.layout.fframes.IFFrame; |
||
58 | import com.iver.cit.gvsig.gui.layout.fframes.ListViewModel; |
||
59 | |||
60 | 399 | vcaballero | import java.awt.Color; |
61 | 312 | fernando | import java.awt.Component; |
62 | import java.awt.Dimension; |
||
63 | 3374 | caballero | import java.awt.event.KeyEvent; |
64 | 312 | fernando | import java.awt.geom.Rectangle2D; |
65 | |||
66 | import javax.swing.ImageIcon; |
||
67 | 596 | fernando | import javax.swing.JButton; |
68 | import javax.swing.JCheckBox; |
||
69 | 399 | vcaballero | import javax.swing.JColorChooser; |
70 | import javax.swing.JDialog; |
||
71 | import javax.swing.JFrame; |
||
72 | 312 | fernando | import javax.swing.JLabel; |
73 | import javax.swing.JList; |
||
74 | import javax.swing.JPanel; |
||
75 | 596 | fernando | import javax.swing.JTextField; |
76 | 312 | fernando | import javax.swing.ListCellRenderer; |
77 | |||
78 | 1074 | vcaballero | |
79 | 312 | fernando | /**
|
80 | * Dialogo para a?adir una barra de escala al Layout.
|
||
81 | *
|
||
82 | * @author Vicente Caballero Navarro
|
||
83 | */
|
||
84 | public class FFrameScaleBarDialog extends JPanel implements IFFrameDialog { |
||
85 | 2268 | fjp | private static final ImageIcon inumero = new ImageIcon(AddLayer.class.getClassLoader() |
86 | 1074 | vcaballero | .getResource("images/numero.png"));
|
87 | 2268 | fjp | private static final ImageIcon ibarra1 = new ImageIcon(AddLayer.class.getClassLoader() |
88 | 1074 | vcaballero | .getResource("images/barra1.png"));
|
89 | 2268 | fjp | private static final ImageIcon ibarra2 = new ImageIcon(AddLayer.class.getClassLoader() |
90 | 1074 | vcaballero | .getResource("images/barra2.png"));
|
91 | 2268 | fjp | private static final ImageIcon ibarra3 = new ImageIcon(AddLayer.class.getClassLoader() |
92 | 1074 | vcaballero | .getResource("images/barra3.png"));
|
93 | private javax.swing.JPanel jContentPane = null; |
||
94 | private javax.swing.JScrollPane jScrollPane = null; |
||
95 | private javax.swing.JList liVistas = null; |
||
96 | private javax.swing.JCheckBox chbMantenerIntervalo = null; |
||
97 | private javax.swing.JComboBox cbEscala = null; |
||
98 | private javax.swing.JComboBox cbUnidades = null; |
||
99 | private javax.swing.JLabel lIntervalo = null; |
||
100 | private javax.swing.JTextField tIntervalo = null; |
||
101 | private javax.swing.JLabel lNumIntervalos = null; |
||
102 | private javax.swing.JTextField tNumIntervalos = null; |
||
103 | private javax.swing.JLabel lDivIzquierda = null; |
||
104 | private javax.swing.JTextField tDivIzquierda = null; |
||
105 | private javax.swing.JButton bAceptar = null; |
||
106 | private javax.swing.JButton bCancelar = null; |
||
107 | 312 | fernando | |
108 | 1074 | vcaballero | //private ProjectView m_projectView=null;
|
109 | private FFrameView fframeview = null; |
||
110 | private Rectangle2D rect = new Rectangle2D.Double(); |
||
111 | private Layout m_layout = null; |
||
112 | private FFrameScaleBar fframescalebar = null; //new FFrameScaleBar(); |
||
113 | private boolean isAcepted = false; |
||
114 | private ImageIcon[] images = new ImageIcon[4]; |
||
115 | private javax.swing.JButton bFuente = null; |
||
116 | private JPanel pMarcoVista = null; |
||
117 | 399 | vcaballero | private JPanel pDescripcion = null; |
118 | private JTextField tfDescripcion = null; |
||
119 | private JPanel pUnidades = null; |
||
120 | private JCheckBox chbSobreDescripcion = null; |
||
121 | private JCheckBox chbMostrarUnidades = null; |
||
122 | private JCheckBox chbSobreUnidades = null; |
||
123 | private JPanel pEtiquetas = null; |
||
124 | private JCheckBox chbEtiquetas = null; |
||
125 | private JPanel pBarra = null; |
||
126 | private JPanel jPanel5 = null; |
||
127 | private JPanel jPanel6 = null; |
||
128 | private JPanel jPanel7 = null; |
||
129 | private JButton bUnidadesColor = null; |
||
130 | private JButton bBarraColor = null; |
||
131 | 1074 | vcaballero | private Color barcolor = null; |
132 | private Color textcolor = null; |
||
133 | |||
134 | 399 | vcaballero | //private JPanel jPanel = null;
|
135 | //private JPanel jPanel1 = null;
|
||
136 | private JPanel jPanel2 = null; |
||
137 | private JCheckBox jCheckBox = null; |
||
138 | 2305 | vcaballero | private JPRotation pRotation = null; |
139 | 2592 | caballero | private JLabel lblBarColor = null; |
140 | private JLabel lblLabelColor = null; |
||
141 | 3374 | caballero | private JTextField txtNumDec = null; |
142 | private JLabel lblNumDec = null; |
||
143 | 312 | fernando | |
144 | 1074 | vcaballero | /**
|
145 | * This is the default constructor
|
||
146 | *
|
||
147 | * @param layout DOCUMENT ME!
|
||
148 | * @param fframe DOCUMENT ME!
|
||
149 | */
|
||
150 | public FFrameScaleBarDialog(Layout layout, FFrameScaleBar fframe) {
|
||
151 | super();
|
||
152 | fframescalebar = fframe; |
||
153 | barcolor = fframescalebar.getBarColor(); |
||
154 | textcolor = fframescalebar.getTextColor(); |
||
155 | 312 | fernando | |
156 | 3327 | caballero | if (fframescalebar.getFFrameDependence() != null && fframescalebar.getDescripcion().equals("")) { |
157 | 1074 | vcaballero | getTfDescripcion().setText("escala 1:" +
|
158 | 3114 | caballero | String.valueOf(((FFrameView)fframescalebar.getFFrameDependence()).getScale()));
|
159 | 1074 | vcaballero | } |
160 | 312 | fernando | |
161 | 1074 | vcaballero | m_layout = layout; |
162 | initialize(); |
||
163 | } |
||
164 | 312 | fernando | |
165 | 1074 | vcaballero | /**
|
166 | * DOCUMENT ME!
|
||
167 | *
|
||
168 | * @param r DOCUMENT ME!
|
||
169 | */
|
||
170 | public void setRectangle(Rectangle2D r) { |
||
171 | rect.setRect(r); |
||
172 | } |
||
173 | 312 | fernando | |
174 | 1074 | vcaballero | /**
|
175 | * This method initializes this
|
||
176 | */
|
||
177 | private void initialize() { |
||
178 | this.setLayout(null); |
||
179 | this.add(getJContentPane(), null); |
||
180 | 2305 | vcaballero | this.setSize(621, 400); |
181 | 312 | fernando | |
182 | 1074 | vcaballero | if (fframescalebar.getStyle() == 0) { |
183 | getChbMantenerIntervalo().setEnabled(false);
|
||
184 | 312 | fernando | |
185 | 1074 | vcaballero | ///getLUnidades().setEnabled(false);
|
186 | getCbUnidades().setEnabled(false);
|
||
187 | getChbEtiquetas().setEnabled(false);
|
||
188 | getBBarraColor().setEnabled(false);
|
||
189 | getChbMostrarUnidades().setEnabled(false);
|
||
190 | getChbSobreUnidades().setEnabled(false);
|
||
191 | getLIntervalo().setEnabled(false);
|
||
192 | getTIntervalo().setEnabled(false);
|
||
193 | getLNumIntervalos().setEnabled(false);
|
||
194 | getTNumIntervalos().setEnabled(false);
|
||
195 | getLDivIzquierda().setEnabled(false);
|
||
196 | getTDivIzquierda().setEnabled(false);
|
||
197 | } |
||
198 | 2305 | vcaballero | getPRotation().setRotation(fframescalebar.getRotation()); |
199 | 1074 | vcaballero | } |
200 | 312 | fernando | |
201 | 1074 | vcaballero | /**
|
202 | * This method initializes jContentPane
|
||
203 | *
|
||
204 | * @return javax.swing.JPanel
|
||
205 | */
|
||
206 | private javax.swing.JPanel getJContentPane() {
|
||
207 | if (jContentPane == null) { |
||
208 | jContentPane = new javax.swing.JPanel();
|
||
209 | jContentPane.setLayout(null);
|
||
210 | jContentPane.add(getBAceptar(), null);
|
||
211 | jContentPane.add(getBCancelar(), null);
|
||
212 | 2305 | vcaballero | jContentPane.add(getPRotation(), null);
|
213 | jContentPane.setSize(617, 386); |
||
214 | 1074 | vcaballero | jContentPane.setPreferredSize(new java.awt.Dimension(50, 50)); |
215 | jContentPane.setLocation(0, 6); |
||
216 | jContentPane.add(getPMarcoVista(), null);
|
||
217 | jContentPane.add(getPDescripcion(), null);
|
||
218 | jContentPane.add(getPUnidades(), null);
|
||
219 | jContentPane.add(getPBarra(), null);
|
||
220 | jContentPane.add(getPEtiquetas(), null);
|
||
221 | } |
||
222 | 312 | fernando | |
223 | 1074 | vcaballero | return jContentPane;
|
224 | } |
||
225 | 312 | fernando | |
226 | 1074 | vcaballero | /**
|
227 | * This method initializes jScrollPane
|
||
228 | *
|
||
229 | * @return javax.swing.JScrollPane
|
||
230 | */
|
||
231 | private javax.swing.JScrollPane getJScrollPane() {
|
||
232 | if (jScrollPane == null) { |
||
233 | jScrollPane = new javax.swing.JScrollPane();
|
||
234 | jScrollPane.setPreferredSize(new java.awt.Dimension(220, 50)); |
||
235 | jScrollPane.setViewportView(getLiVistas()); |
||
236 | } |
||
237 | 312 | fernando | |
238 | 1074 | vcaballero | return jScrollPane;
|
239 | } |
||
240 | 312 | fernando | |
241 | 1074 | vcaballero | /**
|
242 | * This method initializes liVistas
|
||
243 | *
|
||
244 | * @return javax.swing.JList
|
||
245 | */
|
||
246 | private javax.swing.JList getLiVistas() {
|
||
247 | if (liVistas == null) { |
||
248 | ListViewModel listmodel = new ListViewModel();
|
||
249 | 2915 | caballero | listmodel.addViews(m_layout); |
250 | 312 | fernando | |
251 | 1074 | vcaballero | ///ArrayList list = listmodel.getViews();
|
252 | 312 | fernando | |
253 | 1074 | vcaballero | liVistas = new javax.swing.JList();
|
254 | 312 | fernando | |
255 | 1074 | vcaballero | liVistas.setModel(listmodel); |
256 | 312 | fernando | |
257 | 1074 | vcaballero | for (int i = 0; i < liVistas.getModel().getSize(); i++) { |
258 | 3114 | caballero | if (fframescalebar.getFFrameDependence() != null) { |
259 | 1074 | vcaballero | fframeview = (FFrameView) liVistas.getModel().getElementAt(i); |
260 | 312 | fernando | |
261 | 3114 | caballero | if (fframeview == fframescalebar.getFFrameDependence()) {
|
262 | 1074 | vcaballero | liVistas.setSelectedIndex(i); |
263 | } |
||
264 | } |
||
265 | } |
||
266 | 312 | fernando | |
267 | 1074 | vcaballero | liVistas.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
268 | 3239 | caballero | private int selectIndex=-1; |
269 | 1074 | vcaballero | public void valueChanged( |
270 | 4778 | caballero | javax.swing.event.ListSelectionEvent e) { |
271 | int selectInt = (int) ((JList) e.getSource()) |
||
272 | .getSelectedIndex(); |
||
273 | if (selectInt != selectIndex) {
|
||
274 | selectIndex = selectInt; |
||
275 | if (selectIndex == -1) |
||
276 | return;
|
||
277 | fframeview = (FFrameView) liVistas.getModel() |
||
278 | .getElementAt(selectInt); |
||
279 | 312 | fernando | |
280 | 4778 | caballero | for (int i = 0; i < m_layout.getFFrames().length; i++) { |
281 | IFFrame f = (IFFrame) m_layout.getFFrame(i); |
||
282 | 312 | fernando | |
283 | 4778 | caballero | if (f instanceof FFrameView) { |
284 | if (((FFrameView) f).getView() == fframeview
|
||
285 | .getView()) { |
||
286 | fframescalebar |
||
287 | .setFFrameDependence(fframeview); |
||
288 | } |
||
289 | } |
||
290 | 1074 | vcaballero | } |
291 | 4778 | caballero | |
292 | getTNumIntervalos().setText( |
||
293 | String.valueOf(fframescalebar
|
||
294 | .getNumInterval())); |
||
295 | getTDivIzquierda().setText( |
||
296 | String.valueOf(fframescalebar
|
||
297 | .getNumLeft())); |
||
298 | getTIntervalo().setText( |
||
299 | fframescalebar.obtainInterval()); |
||
300 | getTfDescripcion().setText( |
||
301 | fframescalebar.getDescripcion()); |
||
302 | 1074 | vcaballero | } |
303 | } |
||
304 | 4778 | caballero | }); |
305 | 1074 | vcaballero | } |
306 | 312 | fernando | |
307 | 1074 | vcaballero | return liVistas;
|
308 | } |
||
309 | 312 | fernando | |
310 | 1074 | vcaballero | /**
|
311 | * This method initializes chbMantenerIntervalo
|
||
312 | *
|
||
313 | * @return javax.swing.JCheckBox
|
||
314 | */
|
||
315 | private javax.swing.JCheckBox getChbMantenerIntervalo() {
|
||
316 | if (chbMantenerIntervalo == null) { |
||
317 | chbMantenerIntervalo = new javax.swing.JCheckBox();
|
||
318 | chbMantenerIntervalo.setSelected(fframescalebar.isbIntervalSet()); |
||
319 | chbMantenerIntervalo.setText(PluginServices.getText(this,
|
||
320 | "mantener_intervalo"));
|
||
321 | chbMantenerIntervalo.setPreferredSize(new java.awt.Dimension(200, 20)); |
||
322 | chbMantenerIntervalo.addActionListener(new java.awt.event.ActionListener() {
|
||
323 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
324 | fframescalebar.setIntervalSet(getChbMantenerIntervalo() |
||
325 | .isSelected()); |
||
326 | } |
||
327 | }); |
||
328 | } |
||
329 | 312 | fernando | |
330 | 1074 | vcaballero | return chbMantenerIntervalo;
|
331 | } |
||
332 | 312 | fernando | |
333 | 1074 | vcaballero | /**
|
334 | * This method initializes cbEscala
|
||
335 | *
|
||
336 | * @return javax.swing.JComboBox
|
||
337 | */
|
||
338 | private javax.swing.JComboBox getCbEscala() {
|
||
339 | if (cbEscala == null) { |
||
340 | //String[] s={"n?merico","barra1","barra2","barra3","barra4"};
|
||
341 | cbEscala = new javax.swing.JComboBox();
|
||
342 | images[0] = inumero;
|
||
343 | images[1] = ibarra1;
|
||
344 | images[2] = ibarra2;
|
||
345 | images[3] = ibarra3;
|
||
346 | 312 | fernando | |
347 | 1074 | vcaballero | /* Image img=img = new BufferedImage(100, 25,
|
348 | BufferedImage.TYPE_INT_ARGB);
|
||
349 | img.getGraphics().drawImage(images[3].getImage(),0,0,null);
|
||
350 | img.getGraphics().setXORMode(Color.yellow);
|
||
351 | images[3]=new ImageIcon(img);
|
||
352 | */
|
||
353 | ComboBoxRenderer renderer = new ComboBoxRenderer();
|
||
354 | renderer.setPreferredSize(new Dimension(100, 25)); |
||
355 | cbEscala.setRenderer(renderer); |
||
356 | cbEscala.setMaximumRowCount(4);
|
||
357 | 312 | fernando | |
358 | 1074 | vcaballero | cbEscala.addItem("0");
|
359 | cbEscala.addItem("1");
|
||
360 | cbEscala.addItem("2");
|
||
361 | cbEscala.addItem("3");
|
||
362 | cbEscala.setSelectedIndex(fframescalebar.getStyle()); |
||
363 | cbEscala.setPreferredSize(new java.awt.Dimension(200, 20)); |
||
364 | cbEscala.addActionListener(new java.awt.event.ActionListener() {
|
||
365 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
366 | fframescalebar.setStyle(getCbEscala().getSelectedIndex()); |
||
367 | 312 | fernando | |
368 | 1074 | vcaballero | if (cbEscala.getSelectedIndex() == 0) { |
369 | getChbMantenerIntervalo().setEnabled(false);
|
||
370 | getChbMostrarUnidades().setEnabled(false);
|
||
371 | getChbSobreUnidades().setEnabled(false);
|
||
372 | getCbUnidades().setEnabled(false);
|
||
373 | getChbEtiquetas().setEnabled(false);
|
||
374 | getBBarraColor().setEnabled(false);
|
||
375 | getLIntervalo().setEnabled(false);
|
||
376 | getTIntervalo().setEnabled(false);
|
||
377 | getLNumIntervalos().setEnabled(false);
|
||
378 | getTNumIntervalos().setEnabled(false);
|
||
379 | getLDivIzquierda().setEnabled(false);
|
||
380 | getTDivIzquierda().setEnabled(false);
|
||
381 | } else {
|
||
382 | getChbMantenerIntervalo().setEnabled(true);
|
||
383 | getChbMostrarUnidades().setEnabled(true);
|
||
384 | getChbSobreUnidades().setEnabled(true);
|
||
385 | getCbUnidades().setEnabled(true);
|
||
386 | getChbEtiquetas().setEnabled(true);
|
||
387 | getBBarraColor().setEnabled(true);
|
||
388 | getLIntervalo().setEnabled(true);
|
||
389 | getTIntervalo().setEnabled(true);
|
||
390 | getLNumIntervalos().setEnabled(true);
|
||
391 | getTNumIntervalos().setEnabled(true);
|
||
392 | getLDivIzquierda().setEnabled(true);
|
||
393 | getTDivIzquierda().setEnabled(true);
|
||
394 | } |
||
395 | } |
||
396 | }); |
||
397 | } |
||
398 | 312 | fernando | |
399 | 1074 | vcaballero | return cbEscala;
|
400 | } |
||
401 | 312 | fernando | |
402 | 1074 | vcaballero | /**
|
403 | * This method initializes cbUnidades
|
||
404 | *
|
||
405 | * @return javax.swing.JComboBox
|
||
406 | */
|
||
407 | private javax.swing.JComboBox getCbUnidades() {
|
||
408 | if (cbUnidades == null) { |
||
409 | //String[] s={"Kil?metros","metros","cent?metros","mil?metros","millas","yardas","pies","pulgadas"};
|
||
410 | cbUnidades = new javax.swing.JComboBox(Attributes.NAMES); |
||
411 | cbUnidades.setSelectedIndex(fframescalebar.getUnits()); |
||
412 | cbUnidades.setPreferredSize(new java.awt.Dimension(150, 20)); |
||
413 | cbUnidades.addActionListener(new java.awt.event.ActionListener() {
|
||
414 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
415 | fframescalebar.setUnits(getCbUnidades() |
||
416 | .getSelectedIndex()); |
||
417 | 3374 | caballero | getTIntervalo().setText(fframescalebar.obtainInterval()); |
418 | 1074 | vcaballero | } |
419 | }); |
||
420 | } |
||
421 | 312 | fernando | |
422 | 1074 | vcaballero | return cbUnidades;
|
423 | } |
||
424 | 312 | fernando | |
425 | 1074 | vcaballero | /**
|
426 | * This method initializes lIntervalo
|
||
427 | *
|
||
428 | * @return javax.swing.JLabel
|
||
429 | */
|
||
430 | private javax.swing.JLabel getLIntervalo() {
|
||
431 | if (lIntervalo == null) { |
||
432 | lIntervalo = new javax.swing.JLabel();
|
||
433 | lIntervalo.setText(PluginServices.getText(this, "Intervalo")); |
||
434 | lIntervalo.setPreferredSize(new java.awt.Dimension(90, 20)); |
||
435 | } |
||
436 | 312 | fernando | |
437 | 1074 | vcaballero | return lIntervalo;
|
438 | } |
||
439 | 312 | fernando | |
440 | 1074 | vcaballero | /**
|
441 | * This method initializes tIntervalo
|
||
442 | *
|
||
443 | * @return javax.swing.JTextField
|
||
444 | */
|
||
445 | private javax.swing.JTextField getTIntervalo() {
|
||
446 | if (tIntervalo == null) { |
||
447 | tIntervalo = new javax.swing.JTextField();
|
||
448 | tIntervalo.setPreferredSize(new java.awt.Dimension(90, 20)); |
||
449 | 3374 | caballero | tIntervalo.setText(fframescalebar.getInterval()); |
450 | 1074 | vcaballero | tIntervalo.addKeyListener(new java.awt.event.KeyAdapter() {
|
451 | public void keyReleased(java.awt.event.KeyEvent e) { |
||
452 | if (!tIntervalo.getText().toString().equals("")) { |
||
453 | 3290 | caballero | fframescalebar.setInterval(Double.parseDouble(
|
454 | 1074 | vcaballero | tIntervalo.getText().toString())); |
455 | getTNumIntervalos().setText(String.valueOf(
|
||
456 | fframescalebar.getNumInterval())); |
||
457 | } |
||
458 | } |
||
459 | }); |
||
460 | } |
||
461 | 312 | fernando | |
462 | 1074 | vcaballero | return tIntervalo;
|
463 | } |
||
464 | 312 | fernando | |
465 | 1074 | vcaballero | /**
|
466 | * This method initializes lNumIntervalos
|
||
467 | *
|
||
468 | * @return javax.swing.JLabel
|
||
469 | */
|
||
470 | private javax.swing.JLabel getLNumIntervalos() {
|
||
471 | if (lNumIntervalos == null) { |
||
472 | lNumIntervalos = new javax.swing.JLabel();
|
||
473 | 5503 | cesar | lNumIntervalos.setText(PluginServices.getText(this, "Num_intervalos")); |
474 | 1074 | vcaballero | lNumIntervalos.setPreferredSize(new java.awt.Dimension(90, 20)); |
475 | } |
||
476 | 312 | fernando | |
477 | 1074 | vcaballero | return lNumIntervalos;
|
478 | } |
||
479 | 312 | fernando | |
480 | 1074 | vcaballero | /**
|
481 | * This method initializes tNumIntervalos
|
||
482 | *
|
||
483 | * @return javax.swing.JTextField
|
||
484 | */
|
||
485 | private javax.swing.JTextField getTNumIntervalos() {
|
||
486 | if (tNumIntervalos == null) { |
||
487 | tNumIntervalos = new javax.swing.JTextField();
|
||
488 | tNumIntervalos.setPreferredSize(new java.awt.Dimension(90, 20)); |
||
489 | tNumIntervalos.setText(Integer.toString(
|
||
490 | fframescalebar.getNumInterval())); |
||
491 | tNumIntervalos.addKeyListener(new java.awt.event.KeyAdapter() {
|
||
492 | public void keyReleased(java.awt.event.KeyEvent e) { |
||
493 | if (!tNumIntervalos.getText().toString().equals("")) { |
||
494 | fframescalebar.setNumInterval(Integer.parseInt(
|
||
495 | tNumIntervalos.getText().toString())); |
||
496 | 3374 | caballero | getTIntervalo().setText(fframescalebar.obtainInterval()); |
497 | 1074 | vcaballero | } |
498 | } |
||
499 | }); |
||
500 | } |
||
501 | 312 | fernando | |
502 | 1074 | vcaballero | return tNumIntervalos;
|
503 | } |
||
504 | 312 | fernando | |
505 | 1074 | vcaballero | /**
|
506 | * This method initializes lDivIzquierda
|
||
507 | *
|
||
508 | * @return javax.swing.JLabel
|
||
509 | */
|
||
510 | private javax.swing.JLabel getLDivIzquierda() {
|
||
511 | if (lDivIzquierda == null) { |
||
512 | lDivIzquierda = new javax.swing.JLabel();
|
||
513 | lDivIzquierda.setText(PluginServices.getText(this,
|
||
514 | "divisiones_izquierda"));
|
||
515 | lDivIzquierda.setPreferredSize(new java.awt.Dimension(90, 20)); |
||
516 | } |
||
517 | 312 | fernando | |
518 | 1074 | vcaballero | return lDivIzquierda;
|
519 | } |
||
520 | 312 | fernando | |
521 | 1074 | vcaballero | /**
|
522 | * This method initializes tDivIzquierda
|
||
523 | *
|
||
524 | * @return javax.swing.JTextField
|
||
525 | */
|
||
526 | private javax.swing.JTextField getTDivIzquierda() {
|
||
527 | if (tDivIzquierda == null) { |
||
528 | tDivIzquierda = new javax.swing.JTextField();
|
||
529 | tDivIzquierda.setPreferredSize(new java.awt.Dimension(90, 20)); |
||
530 | tDivIzquierda.setText(Integer.toString(fframescalebar.getNumLeft()));
|
||
531 | tDivIzquierda.addKeyListener(new java.awt.event.KeyAdapter() {
|
||
532 | public void keyReleased(java.awt.event.KeyEvent e) { |
||
533 | if (tDivIzquierda.getText().toString().equals("")) { |
||
534 | tDivIzquierda.setText("0");
|
||
535 | } else {
|
||
536 | fframescalebar.setNumLeft(Integer.parseInt(
|
||
537 | tDivIzquierda.getText())); |
||
538 | } |
||
539 | } |
||
540 | }); |
||
541 | } |
||
542 | 312 | fernando | |
543 | 1074 | vcaballero | return tDivIzquierda;
|
544 | } |
||
545 | 312 | fernando | |
546 | 1074 | vcaballero | /**
|
547 | * This method initializes bAceptar
|
||
548 | *
|
||
549 | * @return javax.swing.JButton
|
||
550 | */
|
||
551 | private javax.swing.JButton getBAceptar() {
|
||
552 | if (bAceptar == null) { |
||
553 | bAceptar = new javax.swing.JButton();
|
||
554 | bAceptar.setSize(85, 26); |
||
555 | bAceptar.setText(PluginServices.getText(this, "Aceptar")); |
||
556 | bAceptar.setLocation(106, 347); |
||
557 | bAceptar.setPreferredSize(new java.awt.Dimension(79, 23)); |
||
558 | bAceptar.addActionListener(new java.awt.event.ActionListener() {
|
||
559 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
560 | fframescalebar.setUnits(getCbUnidades() |
||
561 | .getSelectedIndex()); |
||
562 | fframescalebar.setBoundBox(FLayoutUtilities.toSheetRect( |
||
563 | rect, m_layout.getAT())); |
||
564 | 312 | fernando | |
565 | 1074 | vcaballero | fframescalebar.setBarColor(barcolor); |
566 | fframescalebar.setTextColor(textcolor); |
||
567 | fframescalebar.setShowNameUnits(getChbMostrarUnidades() |
||
568 | .isSelected()); |
||
569 | fframescalebar.setShowDescription(getJCheckBox() |
||
570 | .isSelected()); |
||
571 | fframescalebar.setAboveDescription(getChbSobreDescripcion() |
||
572 | .isSelected()); |
||
573 | fframescalebar.setAboveIntervals(getChbEtiquetas() |
||
574 | .isSelected()); |
||
575 | fframescalebar.setAboveName(getChbSobreUnidades() |
||
576 | .isSelected()); |
||
577 | fframescalebar.setDescripcion(getTfDescripcion() |
||
578 | .getText()); |
||
579 | 2305 | vcaballero | fframescalebar.setRotation(getPRotation().getRotation()); |
580 | 3374 | caballero | fframescalebar.setNumDec(Integer.parseInt(getNumDec().getText()));
|
581 | 1074 | vcaballero | PluginServices.getMDIManager().closeView(FFrameScaleBarDialog.this); |
582 | m_layout.refresh(); |
||
583 | isAcepted = true;
|
||
584 | } |
||
585 | }); |
||
586 | } |
||
587 | 312 | fernando | |
588 | 1074 | vcaballero | return bAceptar;
|
589 | } |
||
590 | 312 | fernando | |
591 | 1074 | vcaballero | /**
|
592 | * This method initializes bCancelar
|
||
593 | *
|
||
594 | * @return javax.swing.JButton
|
||
595 | */
|
||
596 | private javax.swing.JButton getBCancelar() {
|
||
597 | if (bCancelar == null) { |
||
598 | bCancelar = new javax.swing.JButton();
|
||
599 | bCancelar.setSize(85, 26); |
||
600 | bCancelar.setText(PluginServices.getText(this, "Cancelar")); |
||
601 | bCancelar.setLocation(297, 347); |
||
602 | bCancelar.setPreferredSize(new java.awt.Dimension(85, 23)); |
||
603 | bCancelar.addActionListener(new java.awt.event.ActionListener() {
|
||
604 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
605 | PluginServices.getMDIManager().closeView(FFrameScaleBarDialog.this); |
||
606 | } |
||
607 | }); |
||
608 | } |
||
609 | 312 | fernando | |
610 | 1074 | vcaballero | return bCancelar;
|
611 | } |
||
612 | 312 | fernando | |
613 | 1074 | vcaballero | /* (non-Javadoc)
|
614 | * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
||
615 | */
|
||
616 | public ViewInfo getViewInfo() {
|
||
617 | ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
|
||
618 | m_viewinfo.setTitle(PluginServices.getText(this,
|
||
619 | "Propiedades_escala_grafica"));
|
||
620 | 312 | fernando | |
621 | 1074 | vcaballero | return m_viewinfo;
|
622 | } |
||
623 | 312 | fernando | |
624 | 1074 | vcaballero | /**
|
625 | * @see com.iver.cit.gvsig.gui.layout.fframes.dialogs.IFFrameDialog#getIsAcepted()
|
||
626 | */
|
||
627 | public boolean getIsAcepted() { |
||
628 | return isAcepted;
|
||
629 | } |
||
630 | 312 | fernando | |
631 | 399 | vcaballero | /**
|
632 | 1074 | vcaballero | * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
633 | */
|
||
634 | public void viewActivated() { |
||
635 | } |
||
636 | |||
637 | /**
|
||
638 | * This method initializes bFuente
|
||
639 | *
|
||
640 | * @return javax.swing.JButton
|
||
641 | */
|
||
642 | private javax.swing.JButton getBFuente() {
|
||
643 | if (bFuente == null) { |
||
644 | bFuente = new javax.swing.JButton();
|
||
645 | bFuente.setText(PluginServices.getText(this, "fuente")); |
||
646 | bFuente.addActionListener(new java.awt.event.ActionListener() {
|
||
647 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
648 | fframescalebar.setFont(FontChooser.showDialog( |
||
649 | PluginServices.getText(this, "seleccion_fuente"), |
||
650 | fframescalebar.getFont())); // fchoser=new FontChooser();
|
||
651 | } |
||
652 | }); |
||
653 | } |
||
654 | |||
655 | return bFuente;
|
||
656 | } |
||
657 | |||
658 | /**
|
||
659 | * This method initializes pMarcoVista
|
||
660 | *
|
||
661 | * @return javax.swing.JPanel
|
||
662 | */
|
||
663 | 399 | vcaballero | private JPanel getPMarcoVista() { |
664 | if (pMarcoVista == null) { |
||
665 | pMarcoVista = new JPanel(); |
||
666 | pMarcoVista.setBounds(7, 9, 240, 86); |
||
667 | 1074 | vcaballero | pMarcoVista.setBorder(javax.swing.BorderFactory.createTitledBorder( |
668 | 2560 | caballero | null, PluginServices.getText(this,PluginServices.getText(this,"marco_vista")), |
669 | 1074 | vcaballero | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
670 | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
671 | 399 | vcaballero | pMarcoVista.add(getJScrollPane(), null);
|
672 | } |
||
673 | 1074 | vcaballero | |
674 | 399 | vcaballero | return pMarcoVista;
|
675 | } |
||
676 | 1074 | vcaballero | |
677 | 399 | vcaballero | /**
|
678 | 1074 | vcaballero | * This method initializes pDescripcion
|
679 | *
|
||
680 | * @return javax.swing.JPanel
|
||
681 | */
|
||
682 | 399 | vcaballero | private JPanel getPDescripcion() { |
683 | if (pDescripcion == null) { |
||
684 | pDescripcion = new JPanel(); |
||
685 | pDescripcion.setBounds(256, 9, 216, 110); |
||
686 | 1074 | vcaballero | pDescripcion.setBorder(javax.swing.BorderFactory.createTitledBorder( |
687 | 2560 | caballero | null, PluginServices.getText(this,"descripcion"), |
688 | 1074 | vcaballero | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
689 | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
690 | 399 | vcaballero | pDescripcion.add(getTfDescripcion(), null);
|
691 | pDescripcion.add(getJCheckBox(), null);
|
||
692 | pDescripcion.add(getChbSobreDescripcion(), null);
|
||
693 | } |
||
694 | 1074 | vcaballero | |
695 | 399 | vcaballero | return pDescripcion;
|
696 | } |
||
697 | 1074 | vcaballero | |
698 | 399 | vcaballero | /**
|
699 | 1074 | vcaballero | * This method initializes tfDescripcion
|
700 | *
|
||
701 | * @return javax.swing.JTextField
|
||
702 | */
|
||
703 | 399 | vcaballero | private JTextField getTfDescripcion() { |
704 | if (tfDescripcion == null) { |
||
705 | tfDescripcion = new JTextField(); |
||
706 | 1074 | vcaballero | tfDescripcion.setPreferredSize(new java.awt.Dimension(190, 20)); |
707 | |||
708 | 399 | vcaballero | /*if (fframeview!=null){
|
709 | 1074 | vcaballero | getTfDescripcion().setText("escala 1:"+String.valueOf(fframeview.getScale()));
|
710 | }
|
||
711 | */
|
||
712 | 399 | vcaballero | tfDescripcion.setText(fframescalebar.getDescripcion()); |
713 | } |
||
714 | 1074 | vcaballero | |
715 | 399 | vcaballero | return tfDescripcion;
|
716 | } |
||
717 | 1074 | vcaballero | |
718 | 399 | vcaballero | /**
|
719 | 1074 | vcaballero | * This method initializes pUnidades
|
720 | *
|
||
721 | * @return javax.swing.JPanel
|
||
722 | */
|
||
723 | 399 | vcaballero | private JPanel getPUnidades() { |
724 | if (pUnidades == null) { |
||
725 | pUnidades = new JPanel(); |
||
726 | pUnidades.setLocation(255, 129); |
||
727 | pUnidades.setSize(216, 107); |
||
728 | 1074 | vcaballero | pUnidades.setBorder(javax.swing.BorderFactory.createTitledBorder( |
729 | null, PluginServices.getText(this, "unidades"), |
||
730 | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
||
731 | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
732 | 399 | vcaballero | pUnidades.add(getCbUnidades(), null);
|
733 | pUnidades.add(getChbMostrarUnidades(), null);
|
||
734 | pUnidades.add(getChbSobreUnidades(), null);
|
||
735 | } |
||
736 | 1074 | vcaballero | |
737 | 399 | vcaballero | return pUnidades;
|
738 | } |
||
739 | 1074 | vcaballero | |
740 | 399 | vcaballero | /**
|
741 | 1074 | vcaballero | * This method initializes chbSobreDescripcion
|
742 | *
|
||
743 | * @return javax.swing.JCheckBox
|
||
744 | */
|
||
745 | 399 | vcaballero | private JCheckBox getChbSobreDescripcion() { |
746 | if (chbSobreDescripcion == null) { |
||
747 | chbSobreDescripcion = new JCheckBox(); |
||
748 | chbSobreDescripcion.setSelected(fframescalebar.isAboveDescription()); |
||
749 | 2560 | caballero | chbSobreDescripcion.setText(PluginServices.getText(this,"sobre_la_barra")); |
750 | 399 | vcaballero | } |
751 | 1074 | vcaballero | |
752 | 399 | vcaballero | return chbSobreDescripcion;
|
753 | } |
||
754 | 1074 | vcaballero | |
755 | 399 | vcaballero | /**
|
756 | 1074 | vcaballero | * This method initializes chbMostrarUnidades
|
757 | *
|
||
758 | * @return javax.swing.JCheckBox
|
||
759 | */
|
||
760 | 399 | vcaballero | private JCheckBox getChbMostrarUnidades() { |
761 | if (chbMostrarUnidades == null) { |
||
762 | chbMostrarUnidades = new JCheckBox(); |
||
763 | 2560 | caballero | chbMostrarUnidades.setText(PluginServices.getText(this,"mostrar_unidades")); |
764 | 399 | vcaballero | chbMostrarUnidades.setSelected(fframescalebar.isShowNameUnits()); |
765 | 1074 | vcaballero | chbMostrarUnidades.setPreferredSize(new java.awt.Dimension(150, 24)); |
766 | 399 | vcaballero | } |
767 | 1074 | vcaballero | |
768 | 399 | vcaballero | return chbMostrarUnidades;
|
769 | } |
||
770 | 1074 | vcaballero | |
771 | 399 | vcaballero | /**
|
772 | 1074 | vcaballero | * This method initializes chbSobreUnidades
|
773 | *
|
||
774 | * @return javax.swing.JCheckBox
|
||
775 | */
|
||
776 | 399 | vcaballero | private JCheckBox getChbSobreUnidades() { |
777 | if (chbSobreUnidades == null) { |
||
778 | chbSobreUnidades = new JCheckBox(); |
||
779 | chbSobreUnidades.setSelected(fframescalebar.isAboveName()); |
||
780 | 2560 | caballero | chbSobreUnidades.setText(PluginServices.getText(this,"sobre_la_barra")); |
781 | 1074 | vcaballero | chbSobreUnidades.setPreferredSize(new java.awt.Dimension(150, 24)); |
782 | 399 | vcaballero | } |
783 | 1074 | vcaballero | |
784 | 399 | vcaballero | return chbSobreUnidades;
|
785 | } |
||
786 | 1074 | vcaballero | |
787 | 399 | vcaballero | /**
|
788 | 1074 | vcaballero | * This method initializes pEtiquetas
|
789 | *
|
||
790 | * @return javax.swing.JPanel
|
||
791 | */
|
||
792 | 399 | vcaballero | private JPanel getPEtiquetas() { |
793 | if (pEtiquetas == null) { |
||
794 | pEtiquetas = new JPanel(); |
||
795 | 1074 | vcaballero | pEtiquetas.setBorder(javax.swing.BorderFactory.createTitledBorder( |
796 | null, PluginServices.getText(this, "etiquetas"), |
||
797 | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
||
798 | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
799 | 399 | vcaballero | pEtiquetas.setBounds(257, 246, 216, 93); |
800 | pEtiquetas.add(getChbEtiquetas(), null);
|
||
801 | pEtiquetas.add(getJPanel2(), null);
|
||
802 | } |
||
803 | 1074 | vcaballero | |
804 | 399 | vcaballero | return pEtiquetas;
|
805 | } |
||
806 | 1074 | vcaballero | |
807 | 399 | vcaballero | /**
|
808 | 1074 | vcaballero | * This method initializes chbEtiquetas
|
809 | *
|
||
810 | * @return javax.swing.JCheckBox
|
||
811 | */
|
||
812 | 399 | vcaballero | private JCheckBox getChbEtiquetas() { |
813 | if (chbEtiquetas == null) { |
||
814 | chbEtiquetas = new JCheckBox(); |
||
815 | chbEtiquetas.setSelected(fframescalebar.isAboveIntervals()); |
||
816 | 2580 | caballero | chbEtiquetas.setText(PluginServices.getText(this,"sobre_la_barra")); |
817 | 399 | vcaballero | } |
818 | 1074 | vcaballero | |
819 | 399 | vcaballero | return chbEtiquetas;
|
820 | } |
||
821 | 1074 | vcaballero | |
822 | 399 | vcaballero | /**
|
823 | 1074 | vcaballero | * This method initializes pBarra
|
824 | *
|
||
825 | * @return javax.swing.JPanel
|
||
826 | */
|
||
827 | 399 | vcaballero | private JPanel getPBarra() { |
828 | if (pBarra == null) { |
||
829 | 3374 | caballero | lblNumDec = new JLabel(); |
830 | lblNumDec.setText("numero_decimales_mostrar");
|
||
831 | 2592 | caballero | lblBarColor = new JLabel(); |
832 | lblBarColor.setText(PluginServices.getText(this,"color")); |
||
833 | 399 | vcaballero | pBarra = new JPanel(); |
834 | pBarra.setBounds(8, 104, 240, 235); |
||
835 | 1074 | vcaballero | pBarra.setBorder(javax.swing.BorderFactory.createTitledBorder( |
836 | 2560 | caballero | null, PluginServices.getText(this,"barra"), |
837 | 1074 | vcaballero | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
838 | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
839 | 3469 | caballero | pBarra.add(getChbMantenerIntervalo(), null);
|
840 | 399 | vcaballero | pBarra.add(getCbEscala(), null);
|
841 | 3374 | caballero | pBarra.add(lblNumDec, null);
|
842 | pBarra.add(getNumDec(), null);
|
||
843 | pBarra.add(getJPanel5(), null);
|
||
844 | 399 | vcaballero | pBarra.add(getJPanel7(), null);
|
845 | pBarra.add(getJPanel6(), null);
|
||
846 | 2592 | caballero | pBarra.add(lblBarColor, null);
|
847 | 399 | vcaballero | pBarra.add(getBBarraColor(), null);
|
848 | //pBarra.add(getJPanel(), null);
|
||
849 | } |
||
850 | 1074 | vcaballero | |
851 | 399 | vcaballero | return pBarra;
|
852 | } |
||
853 | 1074 | vcaballero | |
854 | 399 | vcaballero | /**
|
855 | 1074 | vcaballero | * This method initializes jPanel5
|
856 | *
|
||
857 | * @return javax.swing.JPanel
|
||
858 | */
|
||
859 | 399 | vcaballero | private JPanel getJPanel5() { |
860 | if (jPanel5 == null) { |
||
861 | jPanel5 = new JPanel(); |
||
862 | 1074 | vcaballero | jPanel5.setPreferredSize(new java.awt.Dimension(200, 30)); |
863 | 399 | vcaballero | jPanel5.add(getLIntervalo(), null);
|
864 | jPanel5.add(getTIntervalo(), null);
|
||
865 | } |
||
866 | 1074 | vcaballero | |
867 | 399 | vcaballero | return jPanel5;
|
868 | } |
||
869 | 1074 | vcaballero | |
870 | 399 | vcaballero | /**
|
871 | 1074 | vcaballero | * This method initializes jPanel6
|
872 | *
|
||
873 | * @return javax.swing.JPanel
|
||
874 | */
|
||
875 | 399 | vcaballero | private JPanel getJPanel6() { |
876 | if (jPanel6 == null) { |
||
877 | jPanel6 = new JPanel(); |
||
878 | jPanel6.add(getLDivIzquierda(), null);
|
||
879 | jPanel6.add(getTDivIzquierda(), null);
|
||
880 | } |
||
881 | 1074 | vcaballero | |
882 | 399 | vcaballero | return jPanel6;
|
883 | } |
||
884 | 1074 | vcaballero | |
885 | 399 | vcaballero | /**
|
886 | 1074 | vcaballero | * This method initializes jPanel7
|
887 | *
|
||
888 | * @return javax.swing.JPanel
|
||
889 | */
|
||
890 | 399 | vcaballero | private JPanel getJPanel7() { |
891 | if (jPanel7 == null) { |
||
892 | jPanel7 = new JPanel(); |
||
893 | jPanel7.add(getLNumIntervalos(), null);
|
||
894 | jPanel7.add(getTNumIntervalos(), null);
|
||
895 | } |
||
896 | 1074 | vcaballero | |
897 | 399 | vcaballero | return jPanel7;
|
898 | } |
||
899 | 1074 | vcaballero | |
900 | 399 | vcaballero | /**
|
901 | 1074 | vcaballero | * This method initializes bUnidadesColor
|
902 | *
|
||
903 | * @return javax.swing.JButton
|
||
904 | */
|
||
905 | 399 | vcaballero | private JButton getBUnidadesColor() { |
906 | if (bUnidadesColor == null) { |
||
907 | bUnidadesColor = new JButton(); |
||
908 | bUnidadesColor.setForeground(Color.white);
|
||
909 | 2592 | caballero | bUnidadesColor.setPreferredSize(new java.awt.Dimension(25,25)); |
910 | 399 | vcaballero | bUnidadesColor.setBackground(textcolor); |
911 | 1074 | vcaballero | bUnidadesColor.addActionListener(new java.awt.event.ActionListener() {
|
912 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
913 | JDialog dlg;
|
||
914 | JColorChooser colorChooser;
|
||
915 | colorChooser = new JColorChooser(); |
||
916 | dlg = JColorChooser.createDialog((JFrame) null, |
||
917 | PluginServices.getText(this, "Elegir_Color"), |
||
918 | true, colorChooser, null, null); |
||
919 | dlg.show(true);
|
||
920 | |||
921 | textcolor = (Color) colorChooser.getColor();
|
||
922 | |||
923 | //getJPanel1().setBackground(textcolor);
|
||
924 | bUnidadesColor.setBackground(textcolor); |
||
925 | } |
||
926 | }); |
||
927 | 399 | vcaballero | } |
928 | 1074 | vcaballero | |
929 | 399 | vcaballero | return bUnidadesColor;
|
930 | } |
||
931 | 1074 | vcaballero | |
932 | 399 | vcaballero | /**
|
933 | 1074 | vcaballero | * This method initializes bBarraColor
|
934 | *
|
||
935 | * @return javax.swing.JButton
|
||
936 | */
|
||
937 | 399 | vcaballero | private JButton getBBarraColor() { |
938 | if (bBarraColor == null) { |
||
939 | bBarraColor = new JButton(); |
||
940 | bBarraColor.setForeground(Color.white);
|
||
941 | 2592 | caballero | bBarraColor.setPreferredSize(new java.awt.Dimension(25,25)); |
942 | 399 | vcaballero | bBarraColor.setBackground(barcolor); |
943 | 1074 | vcaballero | bBarraColor.addActionListener(new java.awt.event.ActionListener() {
|
944 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
945 | JDialog dlg;
|
||
946 | JColorChooser colorChooser;
|
||
947 | colorChooser = new JColorChooser(); |
||
948 | dlg = JColorChooser.createDialog((JFrame) null, |
||
949 | PluginServices.getText(this, "Elegir_Color"), |
||
950 | true, colorChooser, null, null); |
||
951 | dlg.show(true);
|
||
952 | |||
953 | barcolor = (Color) colorChooser.getColor();
|
||
954 | |||
955 | //getJPanel().setBackground(barcolor);
|
||
956 | bBarraColor.setBackground(barcolor); |
||
957 | } |
||
958 | }); |
||
959 | 399 | vcaballero | } |
960 | 1074 | vcaballero | |
961 | 399 | vcaballero | return bBarraColor;
|
962 | } |
||
963 | 1074 | vcaballero | |
964 | 399 | vcaballero | /**
|
965 | 1074 | vcaballero | * This method initializes jPanel
|
966 | *
|
||
967 | * @return javax.swing.JPanel
|
||
968 | */
|
||
969 | |||
970 | 399 | vcaballero | /*private JPanel getJPanel() {
|
971 | 1074 | vcaballero | if (jPanel == null) {
|
972 | jPanel = new JPanel();
|
||
973 | jPanel.setPreferredSize(new java.awt.Dimension(44,24));
|
||
974 | jPanel.setForeground(barcolor);
|
||
975 | jPanel.setBackground(barcolor);
|
||
976 | }
|
||
977 | return jPanel;
|
||
978 | }
|
||
979 | */
|
||
980 | |||
981 | 399 | vcaballero | /**
|
982 | 1074 | vcaballero | * This method initializes jPanel1
|
983 | *
|
||
984 | * @return javax.swing.JPanel
|
||
985 | */
|
||
986 | |||
987 | /* private JPanel getJPanel1() {
|
||
988 | if (jPanel1 == null) {
|
||
989 | jPanel1 = new JPanel();
|
||
990 | jPanel1.setBackground(textcolor);
|
||
991 | jPanel1.setPreferredSize(new java.awt.Dimension(44,24));
|
||
992 | }
|
||
993 | return jPanel1;
|
||
994 | }
|
||
995 | */
|
||
996 | |||
997 | 399 | vcaballero | /**
|
998 | 1074 | vcaballero | * This method initializes jPanel2
|
999 | *
|
||
1000 | * @return javax.swing.JPanel
|
||
1001 | */
|
||
1002 | 399 | vcaballero | private JPanel getJPanel2() { |
1003 | if (jPanel2 == null) { |
||
1004 | 2592 | caballero | lblLabelColor = new JLabel(); |
1005 | lblLabelColor.setText(PluginServices.getText(this,"color")); |
||
1006 | 399 | vcaballero | jPanel2 = new JPanel(); |
1007 | jPanel2.add(getBFuente(), null);
|
||
1008 | 2592 | caballero | jPanel2.add(lblLabelColor, null);
|
1009 | 399 | vcaballero | jPanel2.add(getBUnidadesColor(), null);
|
1010 | 1074 | vcaballero | |
1011 | 399 | vcaballero | //jPanel2.add(getJPanel1(), null);
|
1012 | } |
||
1013 | 1074 | vcaballero | |
1014 | 399 | vcaballero | return jPanel2;
|
1015 | } |
||
1016 | 1074 | vcaballero | |
1017 | 399 | vcaballero | /**
|
1018 | 1074 | vcaballero | * This method initializes jCheckBox
|
1019 | *
|
||
1020 | * @return javax.swing.JCheckBox
|
||
1021 | */
|
||
1022 | 399 | vcaballero | private JCheckBox getJCheckBox() { |
1023 | if (jCheckBox == null) { |
||
1024 | jCheckBox = new JCheckBox(); |
||
1025 | jCheckBox.setSelected(fframescalebar.isShowDescription()); |
||
1026 | 2560 | caballero | jCheckBox.setText(PluginServices.getText(this,"mostrar_descripcion")); |
1027 | 399 | vcaballero | } |
1028 | 1074 | vcaballero | |
1029 | 399 | vcaballero | return jCheckBox;
|
1030 | } |
||
1031 | 1074 | vcaballero | |
1032 | /**
|
||
1033 | * DOCUMENT ME!
|
||
1034 | *
|
||
1035 | * @author Vicente Caballero Navarro
|
||
1036 | */
|
||
1037 | class ComboBoxRenderer extends JLabel implements ListCellRenderer { |
||
1038 | /**
|
||
1039 | * Crea un nuevo ComboBoxRenderer.
|
||
1040 | */
|
||
1041 | public ComboBoxRenderer() {
|
||
1042 | setOpaque(true);
|
||
1043 | setHorizontalAlignment(CENTER); |
||
1044 | setVerticalAlignment(CENTER); |
||
1045 | } |
||
1046 | |||
1047 | /*
|
||
1048 | * This method finds the image and text corresponding
|
||
1049 | * to the selected value and returns the label, set up
|
||
1050 | * to display the text and image.
|
||
1051 | */
|
||
1052 | public Component getListCellRendererComponent(JList list, Object value, |
||
1053 | int index, boolean isSelected, boolean cellHasFocus) { |
||
1054 | //Get the selected index. (The index param isn't
|
||
1055 | //always valid, so just use the value.)
|
||
1056 | ///int selectedIndex = ((Integer)value).intValue();
|
||
1057 | if (isSelected) {
|
||
1058 | setBackground(list.getSelectionBackground()); |
||
1059 | setForeground(list.getSelectionForeground()); |
||
1060 | } else {
|
||
1061 | setBackground(list.getBackground()); |
||
1062 | setForeground(list.getForeground()); |
||
1063 | } |
||
1064 | |||
1065 | ImageIcon icon = images[Integer.parseInt((String) value)]; |
||
1066 | setIcon(icon); |
||
1067 | |||
1068 | return this; |
||
1069 | } |
||
1070 | } |
||
1071 | 2305 | vcaballero | |
1072 | /**
|
||
1073 | 4778 | caballero | * This method initializes pRotation
|
1074 | *
|
||
1075 | * @return javax.swing.JPanel
|
||
1076 | */
|
||
1077 | 2305 | vcaballero | private JPRotation getPRotation() {
|
1078 | if (pRotation == null) { |
||
1079 | pRotation = new JPRotation();
|
||
1080 | pRotation.setBounds(480, 10, 120, 120); |
||
1081 | } |
||
1082 | return pRotation;
|
||
1083 | } |
||
1084 | 3374 | caballero | |
1085 | /**
|
||
1086 | 4778 | caballero | * This method initializes numDec
|
1087 | *
|
||
1088 | * @return javax.swing.JTextField
|
||
1089 | 3374 | caballero | */
|
1090 | private JTextField getNumDec() { |
||
1091 | if (txtNumDec == null) { |
||
1092 | txtNumDec = new JTextField(); |
||
1093 | txtNumDec.setPreferredSize(new java.awt.Dimension(30,20)); |
||
1094 | txtNumDec.setText(String.valueOf(fframescalebar.getNumDec()));
|
||
1095 | txtNumDec.addKeyListener(new java.awt.event.KeyAdapter() {
|
||
1096 | public void keyReleased(KeyEvent arg0) { |
||
1097 | super.keyReleased(arg0);
|
||
1098 | if (!getNumDec().getText().toString().equals("")) { |
||
1099 | fframescalebar.setNumDec(Integer.parseInt(
|
||
1100 | getNumDec().getText().toString())); |
||
1101 | getTIntervalo().setText(fframescalebar.obtainInterval()); |
||
1102 | } |
||
1103 | } |
||
1104 | }); |
||
1105 | } |
||
1106 | return txtNumDec;
|
||
1107 | } |
||
1108 | 1074 | vcaballero | } // @jve:decl-index=0:visual-constraint="17,10"
|
1109 | // @jve:visual-info decl-index=0 visual-constraint="10,10" |