svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / Panels / FPanelLegendDefault.java @ 312
History | View | Annotate | Download (31.8 KB)
1 |
/*
|
---|---|
2 |
* Created on 30-abr-2004
|
3 |
*
|
4 |
* To change the template for this generated file go to
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
*/
|
7 |
package com.iver.cit.gvsig.gui.Panels; |
8 |
|
9 |
import java.awt.BasicStroke; |
10 |
import java.awt.BorderLayout; |
11 |
import java.awt.Color; |
12 |
import java.awt.Component; |
13 |
import java.awt.Dimension; |
14 |
import java.awt.Graphics; |
15 |
import java.awt.Graphics2D; |
16 |
import java.awt.GridBagConstraints; |
17 |
import java.awt.GridBagLayout; |
18 |
import java.awt.Insets; |
19 |
import java.awt.Paint; |
20 |
import java.awt.event.ActionEvent; |
21 |
import java.awt.event.ActionListener; |
22 |
import java.awt.geom.AffineTransform; |
23 |
import java.awt.geom.Line2D; |
24 |
import java.awt.geom.Rectangle2D; |
25 |
import java.io.File; |
26 |
import java.util.List; |
27 |
|
28 |
import javax.swing.BorderFactory; |
29 |
import javax.swing.DefaultComboBoxModel; |
30 |
import javax.swing.ImageIcon; |
31 |
import javax.swing.JButton; |
32 |
import javax.swing.JCheckBox; |
33 |
import javax.swing.JComboBox; |
34 |
import javax.swing.JFileChooser; |
35 |
import javax.swing.JLabel; |
36 |
import javax.swing.JList; |
37 |
import javax.swing.JPanel; |
38 |
import javax.swing.JSlider; |
39 |
import javax.swing.JTextField; |
40 |
import javax.swing.ListCellRenderer; |
41 |
import javax.swing.UIManager; |
42 |
import javax.swing.event.ChangeEvent; |
43 |
import javax.swing.event.ChangeListener; |
44 |
import javax.swing.plaf.basic.BasicComboBoxEditor; |
45 |
|
46 |
import com.iver.cit.gvsig.core.FShape; |
47 |
import com.iver.cit.gvsig.core.BasicShape.FPoint; |
48 |
import com.iver.cit.gvsig.fmap.FConstant; |
49 |
import com.iver.cit.gvsig.fmap.FGraphicUtilities; |
50 |
import com.iver.cit.gvsig.fmap.FSymbol; |
51 |
import com.iver.cit.gvsig.fmap.FSymbolFactory; |
52 |
import com.iver.cit.gvsig.gui.GUIUtil; |
53 |
import com.iver.mdiApp.Utilities; |
54 |
import com.iver.utiles.ImageFilter; |
55 |
import com.vividsolutions.jump.util.StringUtil; |
56 |
/**
|
57 |
* @author fjp
|
58 |
*
|
59 |
* To change the template for this generated type comment go to
|
60 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
61 |
*/
|
62 |
|
63 |
|
64 |
public class FPanelLegendDefault extends JPanel { |
65 |
|
66 |
private FSymbol m_FSymbol = null; |
67 |
|
68 |
|
69 |
protected static final int SLIDER_TEXT_FIELD_COLUMNS = 3; |
70 |
protected static final Dimension SLIDER_DIMENSION = new Dimension(130, 49); |
71 |
// private Paint[] fillPatterns = new FillPatternFactory().createFillPatterns();
|
72 |
private JPanel centerPanel = new JPanel(); |
73 |
// private AbstractPalettePanel palettePanel;
|
74 |
protected JCheckBox fillCheckBox = new JCheckBox(); |
75 |
protected JCheckBox lineCheckBox = new JCheckBox(); |
76 |
protected TransparencyPanel transparencyPanel = new TransparencyPanel(); |
77 |
protected JLabel transparencyLabel = new JLabel(); |
78 |
protected ColorChooserPanel lineColorChooserPanel = new ColorChooserPanel(); |
79 |
protected ColorChooserPanel fillColorChooserPanel = new ColorChooserPanel(); |
80 |
protected ColorChooserPanel pointColorChooserPanel = new ColorChooserPanel(); |
81 |
protected FPreviewSymbol m_previewSymbol = new FPreviewSymbol(); |
82 |
protected JLabel lineWidthLabel = new JLabel(); |
83 |
protected JCheckBox synchronizeCheckBox = new JCheckBox(); |
84 |
private JCheckBox linePatternCheckBox = new JCheckBox(); |
85 |
private JCheckBox fillPatternCheckBox = new JCheckBox(); |
86 |
private Paint[] fillPatterns = FSymbolFactory.createPatternFills(Color.GRAY); |
87 |
private String[] linePatterns = new String[] { |
88 |
"1", "3", "5", "5,1", "7", "7,12", "9", "9,2", "15,6", "20,3" |
89 |
}; |
90 |
|
91 |
private Integer[] pointTypes = new Integer[] { |
92 |
new Integer(FConstant.SYMBOL_STYLE_MARKER_SQUARE), |
93 |
new Integer(FConstant.SYMBOL_STYLE_MARKER_CIRCLE), |
94 |
new Integer(FConstant.SYMBOL_STYLE_MARKER_TRIANGLE), |
95 |
new Integer(FConstant.SYMBOL_STYLE_MARKER_CROSS), |
96 |
new Integer(FConstant.SYMBOL_STYLE_MARKER_IMAGEN) |
97 |
}; |
98 |
|
99 |
protected String pointTypeToString(Integer pointType) |
100 |
{ |
101 |
String resul = "No reconocido"; |
102 |
switch (pointType.intValue())
|
103 |
{ |
104 |
case FConstant.SYMBOL_STYLE_MARKER_SQUARE:
|
105 |
resul = "Cuadrado";
|
106 |
break;
|
107 |
case FConstant.SYMBOL_STYLE_MARKER_CIRCLE:
|
108 |
resul = "C?rculo";
|
109 |
break;
|
110 |
case FConstant.SYMBOL_STYLE_MARKER_TRIANGLE:
|
111 |
resul = "Tri?ngulo";
|
112 |
break;
|
113 |
case FConstant.SYMBOL_STYLE_MARKER_CROSS:
|
114 |
resul = "Cruz";
|
115 |
break;
|
116 |
case FConstant.SYMBOL_STYLE_MARKER_IMAGEN:
|
117 |
resul = "Imagen";
|
118 |
break;
|
119 |
|
120 |
} |
121 |
return resul;
|
122 |
} |
123 |
protected Integer pointTypeToInt(String pointType) |
124 |
{ |
125 |
if (pointType.compareTo("Cuadrado")== 0) |
126 |
return new Integer(FConstant.SYMBOL_STYLE_MARKER_SQUARE); |
127 |
if (pointType.compareTo("C?rculo")== 0) |
128 |
return new Integer(FConstant.SYMBOL_STYLE_MARKER_CIRCLE); |
129 |
if (pointType.compareTo("Tri?ngulo")== 0) |
130 |
return new Integer(FConstant.SYMBOL_STYLE_MARKER_TRIANGLE); |
131 |
if (pointType.compareTo("Cruz")== 0) |
132 |
return new Integer(FConstant.SYMBOL_STYLE_MARKER_CROSS); |
133 |
if (pointType.compareTo("Imagen")== 0) |
134 |
return new Integer(FConstant.SYMBOL_STYLE_MARKER_IMAGEN); |
135 |
return new Integer(-1); |
136 |
} |
137 |
private JComboBox pointTypeComboBox = new JComboBox(pointTypes) { |
138 |
|
139 |
{ |
140 |
BasicComboBoxEditor editor = new BasicComboBoxEditor(); |
141 |
|
142 |
setEditor(editor); |
143 |
setEditable(true);
|
144 |
addActionListener(new ActionListener() { |
145 |
public void actionPerformed(ActionEvent e) { |
146 |
updateControls(); |
147 |
if (getSelectedItem() instanceof Integer) |
148 |
{ |
149 |
setSelectedItem(pointTypeToString((Integer) getSelectedItem()));
|
150 |
|
151 |
updateControls(); |
152 |
} |
153 |
} |
154 |
}); |
155 |
setRenderer(new ListCellRenderer() { |
156 |
private Integer pointType; |
157 |
private FSymbol myFSymbol = new FSymbol(FConstant.SYMBOL_TYPE_POINT); |
158 |
private JPanel panel = new JPanel() { |
159 |
|
160 |
protected void paintComponent(Graphics g) { |
161 |
super.paintComponent(g);
|
162 |
|
163 |
Graphics2D g2 = (Graphics2D) g; |
164 |
AffineTransform mT = new AffineTransform(); |
165 |
mT.setToIdentity(); |
166 |
|
167 |
FShape shp = new FShape(new FPoint(panel.getWidth()/2, |
168 |
panel.getHeight()/2),FConstant.SHAPE_TYPE_POINT);
|
169 |
myFSymbol.m_Color = m_FSymbol.m_Color; |
170 |
FGraphicUtilities.DrawShape(g2,mT, shp,myFSymbol); |
171 |
} |
172 |
}; |
173 |
|
174 |
|
175 |
public Component getListCellRendererComponent( |
176 |
JList list, Object value, int index, |
177 |
boolean isSelected, boolean cellHasFocus) { |
178 |
pointType = (Integer) value;
|
179 |
myFSymbol.m_Style = pointType.intValue(); |
180 |
// Le hacemos que se dibuje siempre con 10 pixels
|
181 |
|
182 |
myFSymbol.m_bUseSize = false;
|
183 |
myFSymbol.m_Size = 10;
|
184 |
myFSymbol.m_Stroke = new BasicStroke(); |
185 |
panel.setForeground(UIManager.getColor(isSelected
|
186 |
? "ComboBox.selectionForeground"
|
187 |
: "ComboBox.foreground"));
|
188 |
panel.setBackground(UIManager.getColor(isSelected
|
189 |
? "ComboBox.selectionBackground"
|
190 |
: "ComboBox.background"));
|
191 |
|
192 |
return panel;
|
193 |
} |
194 |
}); |
195 |
} |
196 |
}; |
197 |
|
198 |
/**
|
199 |
* Converts the comma-delimited string into a List of trimmed strings.
|
200 |
*
|
201 |
* @param linePattern a String with comma-delimited values
|
202 |
* @param lineWidth DOCUMENT ME!
|
203 |
*
|
204 |
* @return a List of the Strings that were delimited by commas
|
205 |
*
|
206 |
* @throws IllegalArgumentException DOCUMENT ME!
|
207 |
*/
|
208 |
public static float[] toArray(String linePattern, float lineWidth) { |
209 |
List strings = StringUtil.fromCommaDelimitedString(linePattern);
|
210 |
float[] array = new float[strings.size()]; |
211 |
|
212 |
for (int i = 0; i < strings.size(); i++) { |
213 |
String string = (String) strings.get(i); |
214 |
array[i] = Float.parseFloat(string) * lineWidth;
|
215 |
|
216 |
if (array[i] <= 0) { |
217 |
throw new IllegalArgumentException("Negative dash length"); |
218 |
} |
219 |
} |
220 |
|
221 |
return array;
|
222 |
} |
223 |
|
224 |
protected JSlider lineWidthSlider = new JSlider() { |
225 |
|
226 |
{ |
227 |
addChangeListener(new ChangeListener() { |
228 |
public void stateChanged(ChangeEvent e) { |
229 |
updateControls(); |
230 |
} |
231 |
}); |
232 |
} |
233 |
}; |
234 |
private JComboBox linePatternComboBox = new JComboBox(linePatterns) { |
235 |
{ |
236 |
BasicComboBoxEditor editor = new BasicComboBoxEditor(); |
237 |
setEditor(editor); |
238 |
setEditable(true);
|
239 |
addActionListener(new ActionListener() { |
240 |
public void actionPerformed(ActionEvent e) { |
241 |
updateControls(); |
242 |
} |
243 |
}); |
244 |
setRenderer(new ListCellRenderer() { |
245 |
private JPanel panel = new JPanel() { |
246 |
private int lineWidth = 2; |
247 |
|
248 |
protected void paintComponent(Graphics g) { |
249 |
super.paintComponent(g);
|
250 |
|
251 |
Graphics2D g2 = (Graphics2D) g; |
252 |
g2.setStroke(new BasicStroke(lineWidth, |
253 |
BasicStroke.CAP_BUTT,
|
254 |
BasicStroke.JOIN_BEVEL, 1.0f, |
255 |
toArray(linePattern, lineWidth), 0));
|
256 |
g2.draw(new Line2D.Double(0, |
257 |
panel.getHeight() / 2.0,
|
258 |
panel.getWidth(), |
259 |
panel.getHeight() / 2.0));
|
260 |
} |
261 |
}; |
262 |
|
263 |
private String linePattern; |
264 |
|
265 |
public Component getListCellRendererComponent( |
266 |
JList list, Object value, int index, |
267 |
boolean isSelected, boolean cellHasFocus) { |
268 |
linePattern = (String) value;
|
269 |
panel.setForeground(UIManager.getColor(isSelected
|
270 |
? "ComboBox.selectionForeground"
|
271 |
: "ComboBox.foreground"));
|
272 |
panel.setBackground(UIManager.getColor(isSelected
|
273 |
? "ComboBox.selectionBackground"
|
274 |
: "ComboBox.background"));
|
275 |
|
276 |
return panel;
|
277 |
} |
278 |
}); |
279 |
} |
280 |
}; |
281 |
|
282 |
|
283 |
private JComboBox fillPatternComboBox = new JComboBox(fillPatterns) { |
284 |
|
285 |
{ |
286 |
// setMaximumRowCount(fillPatterns.length);
|
287 |
setEditable(false);
|
288 |
addActionListener(new ActionListener() { |
289 |
public void actionPerformed(ActionEvent e) { |
290 |
updateControls(); |
291 |
} |
292 |
}); |
293 |
setRenderer(new ListCellRenderer() { |
294 |
private Paint fillPattern; |
295 |
private JLabel label = new JLabel(" "); |
296 |
private JPanel panel = new JPanel(new BorderLayout()) { |
297 |
|
298 |
{ |
299 |
label.setPreferredSize(new Dimension(150, |
300 |
(int) label.getPreferredSize()
|
301 |
.getHeight())); |
302 |
add(label, BorderLayout.CENTER);
|
303 |
} |
304 |
|
305 |
protected void paintComponent(Graphics g) { |
306 |
super.paintComponent(g);
|
307 |
((Graphics2D) g).setPaint(fillPattern);
|
308 |
((Graphics2D) g).fill(new Rectangle2D.Double( |
309 |
0, 0, getWidth(), getHeight())); |
310 |
} |
311 |
}; |
312 |
|
313 |
public Component getListCellRendererComponent( |
314 |
JList list, Object value, int index, |
315 |
boolean isSelected, boolean cellHasFocus) { |
316 |
fillPattern = (Paint) value;
|
317 |
// label.setText("" +(1 +
|
318 |
// CollectionUtil.indexOf(fillPattern, fillPatterns)));
|
319 |
label.setForeground(UIManager.getColor(isSelected
|
320 |
? "ComboBox.selectionForeground"
|
321 |
: "ComboBox.foreground"));
|
322 |
panel.setBackground(UIManager.getColor(isSelected
|
323 |
? "ComboBox.selectionBackground"
|
324 |
: "ComboBox.background"));
|
325 |
|
326 |
return panel;
|
327 |
} |
328 |
}); |
329 |
} |
330 |
}; |
331 |
|
332 |
|
333 |
private javax.swing.JPanel jPanelPoint = null; // |
334 |
private javax.swing.JLabel jLabel = null; |
335 |
private javax.swing.JLabel jLabel1 = null; |
336 |
private javax.swing.JCheckBox jCheckBox = null; |
337 |
private javax.swing.JTextField jTextField_Size = null; |
338 |
private javax.swing.JComboBox jComboBox_Symbol_Type = null; |
339 |
private javax.swing.JLabel jLabel2 = null; |
340 |
private JLabel jLblImagen = null; |
341 |
private JTextField jTxtImagen = null; |
342 |
private JButton jBtnImagen = null; |
343 |
/**
|
344 |
*
|
345 |
*/
|
346 |
public FPanelLegendDefault() {
|
347 |
super();
|
348 |
try {
|
349 |
jbInit(); |
350 |
linePatternCheckBox.setSelected(false);
|
351 |
} catch (Exception e) { |
352 |
e.printStackTrace(); |
353 |
} |
354 |
|
355 |
transparencyPanel.getSlider().getModel().addChangeListener(new ChangeListener() { |
356 |
public void stateChanged(ChangeEvent e) { |
357 |
updateControls(); |
358 |
} |
359 |
}); |
360 |
/* palettePanel.add(new GridPalettePanel.Listener() {
|
361 |
public void basicStyleChosen(BasicStyle basicStyle) {
|
362 |
//Preserve some settings e.g. line and fill patterns, alpha;
|
363 |
BasicStyle newBasicStyle = getBasicStyle();
|
364 |
newBasicStyle.setFillColor(basicStyle.getFillColor());
|
365 |
newBasicStyle.setLineColor(basicStyle.getLineColor());
|
366 |
newBasicStyle.setLineWidth(basicStyle.getLineWidth());
|
367 |
newBasicStyle.setRenderingFill(basicStyle.isRenderingFill());
|
368 |
newBasicStyle.setRenderingLine(basicStyle.isRenderingLine());
|
369 |
setBasicStyle(newBasicStyle);
|
370 |
}
|
371 |
}); */
|
372 |
updateControls(); |
373 |
|
374 |
} |
375 |
|
376 |
void jbInit() throws Exception { |
377 |
java.awt.GridBagConstraints consGridBagConstraints2 = new java.awt.GridBagConstraints();
|
378 |
|
379 |
lineWidthSlider.setPreferredSize(SLIDER_DIMENSION); |
380 |
lineWidthSlider.setPaintLabels(true);
|
381 |
lineWidthSlider.setValue(1);
|
382 |
lineWidthSlider.setLabelTable(lineWidthSlider.createStandardLabels(10));
|
383 |
lineWidthSlider.setMajorTickSpacing(5);
|
384 |
lineWidthSlider.setMaximum(30);
|
385 |
lineWidthSlider.setMinorTickSpacing(1);
|
386 |
|
387 |
|
388 |
JPanel globalPanel = new JPanel(); |
389 |
globalPanel.setLayout(new GridBagLayout()); |
390 |
|
391 |
linePatternCheckBox.setText(Utilities.getMessage(this,"tipo_linea")); |
392 |
fillPatternCheckBox.setText(Utilities.getMessage(this,"tipo_relleno")); |
393 |
linePatternCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
394 |
public void actionPerformed(ActionEvent e) { |
395 |
linePatternCheckBox_actionPerformed(e); |
396 |
} |
397 |
}); |
398 |
fillPatternCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
399 |
public void actionPerformed(ActionEvent e) { |
400 |
fillPatternCheckBox_actionPerformed(e); |
401 |
} |
402 |
}); |
403 |
// add(getJPanelPoint());
|
404 |
globalPanel.add(getCenterPanel(), |
405 |
new GridBagConstraints(0, 0, 1, 2, 0, 0, GridBagConstraints.WEST, |
406 |
GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); |
407 |
|
408 |
/*globalPanel.add(new JPanel(),
|
409 |
new GridBagConstraints(3, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
|
410 |
GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); */
|
411 |
/* globalPanel.add(new JLabel("Previsualizaci?n de s?mbolo:"),
|
412 |
new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
|
413 |
GridBagConstraints.NONE, new Insets(0, 30, 0, 0), 0, 0)); */
|
414 |
|
415 |
JPanel panelAux = new JPanel(); |
416 |
panelAux.add(new JLabel(Utilities.getMessage(this,"Previsualizacion_de_simbolo"))); |
417 |
panelAux.add(m_previewSymbol ); |
418 |
/* globalPanel.add(panelAux, new
|
419 |
GridBagConstraints(2, 1, 1, 1, 1, 1, GridBagConstraints.WEST,
|
420 |
GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); */
|
421 |
|
422 |
|
423 |
m_previewSymbol.setPreferredSize(new Dimension(80,60)); |
424 |
m_previewSymbol.setMinimumSize(new Dimension(80,60)); |
425 |
|
426 |
setLayout(null);
|
427 |
globalPanel.setBounds(0,0,350,250); |
428 |
|
429 |
getJPanelPoint().setBounds(0,0,350,250); |
430 |
add(getJPanelPoint()); //, BorderLayout.WEST); //, consGridBagConstraints2);
|
431 |
add(globalPanel); // , BorderLayout.WEST);
|
432 |
|
433 |
panelAux.setBounds(350,0,150,100); |
434 |
|
435 |
add(panelAux) ; //,BorderLayout.EAST); // Contiene el preview
|
436 |
|
437 |
/* globalPanel.setBackground(Color.RED);
|
438 |
getJPanelPoint().setBackground(Color.BLUE);
|
439 |
panelAux.setBackground(Color.GREEN); */
|
440 |
|
441 |
getCenterPanel().setLayout(new GridBagLayout()); |
442 |
setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
443 |
this.setSize(419, 293); |
444 |
fillColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
|
445 |
public void actionPerformed(ActionEvent e) { |
446 |
fillColorChooserPanel_actionPerformed(e); |
447 |
} |
448 |
}); |
449 |
lineColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
|
450 |
public void actionPerformed(ActionEvent e) { |
451 |
lineColorChooserPanel_actionPerformed(e); |
452 |
} |
453 |
}); |
454 |
|
455 |
synchronizeCheckBox.setText(Utilities.getMessage(this,"sincronizar_color_borde_relleno")); |
456 |
synchronizeCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
457 |
public void actionPerformed(ActionEvent e) { |
458 |
synchronizeCheckBox_actionPerformed(e); |
459 |
} |
460 |
}); |
461 |
fillCheckBox.setText(Utilities.getMessage(this,"relleno")); |
462 |
fillCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
463 |
public void actionPerformed(ActionEvent e) { |
464 |
fillCheckBox_actionPerformed(e); |
465 |
} |
466 |
}); |
467 |
lineCheckBox.setText(Utilities.getMessage(this,"linea")); |
468 |
lineCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
469 |
public void actionPerformed(ActionEvent e) { |
470 |
lineCheckBox_actionPerformed(e); |
471 |
} |
472 |
}); |
473 |
getCenterPanel().add(GUIUtil.createSyncdTextField( |
474 |
transparencyPanel.getSlider(), SLIDER_TEXT_FIELD_COLUMNS), |
475 |
new GridBagConstraints(2, 21, 1, 1, 0.0, 0.0, |
476 |
GridBagConstraints.CENTER, GridBagConstraints.NONE, |
477 |
new Insets(2, 2, 2, 2), 0, 0)); |
478 |
getCenterPanel().add(lineWidthSlider, |
479 |
new GridBagConstraints(1, 19, 1, 1, 0.0, 0.0, |
480 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
481 |
new Insets(2, 2, 2, 2), 0, 0)); |
482 |
getCenterPanel().add(GUIUtil.createSyncdTextField(lineWidthSlider, |
483 |
SLIDER_TEXT_FIELD_COLUMNS), |
484 |
new GridBagConstraints(2, 19, 1, 1, 0.0, 0.0, |
485 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
486 |
new Insets(2, 2, 2, 2), 0, 0)); |
487 |
fillColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
|
488 |
public void actionPerformed(ActionEvent e) { |
489 |
fillColorChooserPanel_actionPerformed(e); |
490 |
} |
491 |
}); |
492 |
lineWidthLabel.setText(Utilities.getMessage(this,"grosor_linea")); |
493 |
transparencyLabel.setText(Utilities.getMessage(this,"transparencia")); |
494 |
consGridBagConstraints2.gridx = 0;
|
495 |
consGridBagConstraints2.gridy = 0;
|
496 |
consGridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST; |
497 |
consGridBagConstraints2.fill = java.awt.GridBagConstraints.NONE; |
498 |
getCenterPanel().add(synchronizeCheckBox, |
499 |
new GridBagConstraints(0, 18, 3, 1, 0.0, 0.0, |
500 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
501 |
new Insets(2, 2, 2, 2), 0, 0)); |
502 |
getCenterPanel().add(transparencyLabel, |
503 |
new GridBagConstraints(0, 21, 1, 1, 0.0, 0.0, |
504 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
505 |
new Insets(2, 2, 2, 2), 0, 0)); |
506 |
getCenterPanel().add(fillColorChooserPanel, |
507 |
new GridBagConstraints(1, 5, 2, 1, 0.0, 0.0, |
508 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
509 |
new Insets(2, 2, 2, 2), 0, 0)); |
510 |
|
511 |
|
512 |
getCenterPanel().add(lineColorChooserPanel, |
513 |
new GridBagConstraints(1, 11, 2, 1, 0.0, 0.0, |
514 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
515 |
new Insets(2, 2, 2, 2), 0, 0)); |
516 |
getCenterPanel().add(transparencyPanel, |
517 |
new GridBagConstraints(1, 21, 1, 1, 0.0, 0.0, |
518 |
GridBagConstraints.CENTER, GridBagConstraints.NONE, |
519 |
new Insets(2, 2, 2, 2), 0, 0)); |
520 |
getCenterPanel().add(fillCheckBox, |
521 |
new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, |
522 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
523 |
new Insets(2, 2, 2, 2), 0, 0)); |
524 |
getCenterPanel().add(lineCheckBox, |
525 |
new GridBagConstraints(0, 11, 1, 1, 0.0, 0.0, |
526 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
527 |
new Insets(2, 2, 2, 2), 0, 0)); |
528 |
getCenterPanel().add(lineWidthLabel, |
529 |
new GridBagConstraints(0, 19, 1, 1, 0.0, 0.0, |
530 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
531 |
new Insets(2, 2, 2, 2), 0, 0)); |
532 |
getCenterPanel().add(linePatternCheckBox, |
533 |
new GridBagConstraints(0, 16, 1, 1, 0.0, 0.0, |
534 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
535 |
new Insets(2, 2, 2, 2), 0, 0)); |
536 |
getCenterPanel().add(fillPatternCheckBox, |
537 |
new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, |
538 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
539 |
new Insets(2, 2, 2, 2), 0, 0)); |
540 |
getCenterPanel().add(linePatternComboBox, |
541 |
new GridBagConstraints(1, 16, 2, 1, 0.0, 0.0, |
542 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
543 |
new Insets(2, 2, 2, 2), 0, 0)); |
544 |
getCenterPanel().add(fillPatternComboBox, |
545 |
new GridBagConstraints(1, 7, 2, 1, 0.0, 0.0, |
546 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
547 |
new Insets(2, 2, 0, 2), 0, 0)); |
548 |
|
549 |
pointTypeComboBox.setBounds(143, 25, 120, 20); |
550 |
pointColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
|
551 |
public void actionPerformed(ActionEvent e) { |
552 |
updateControls(); |
553 |
} |
554 |
}); |
555 |
|
556 |
} |
557 |
|
558 |
protected void setAlpha(int alpha) { |
559 |
transparencyPanel.getSlider().setValue(255 - alpha);
|
560 |
} |
561 |
|
562 |
protected int getAlpha() { |
563 |
return 255 - transparencyPanel.getSlider().getValue(); |
564 |
} |
565 |
|
566 |
void fillCheckBox_actionPerformed(ActionEvent e) { |
567 |
updateControls(); |
568 |
} |
569 |
|
570 |
void lineCheckBox_actionPerformed(ActionEvent e) { |
571 |
updateControls(); |
572 |
} |
573 |
|
574 |
public void setSynchronizingLineColor(boolean newSynchronizingLineColor) { |
575 |
synchronizeCheckBox.setSelected(newSynchronizingLineColor); |
576 |
} |
577 |
|
578 |
protected void synchronizeCheckBox_actionPerformed(ActionEvent e) { |
579 |
if (synchronizeCheckBox.isSelected()) {
|
580 |
syncLineColor(); |
581 |
} |
582 |
|
583 |
updateControls(); |
584 |
} |
585 |
|
586 |
public JCheckBox getSynchronizeCheckBox() { |
587 |
return synchronizeCheckBox;
|
588 |
} |
589 |
|
590 |
void linePatternCheckBox_actionPerformed(ActionEvent e) { |
591 |
updateControls(); |
592 |
} |
593 |
void lineColorChooserPanel_actionPerformed(ActionEvent e) { |
594 |
if (synchronizeCheckBox.isSelected()) {
|
595 |
fillColorChooserPanel.setColor(lineColorChooserPanel.getColor() |
596 |
.brighter()); |
597 |
} |
598 |
|
599 |
updateControls(); |
600 |
} |
601 |
void fillColorChooserPanel_actionPerformed(ActionEvent e) { |
602 |
if (synchronizeCheckBox.isSelected()) {
|
603 |
syncLineColor(); |
604 |
} |
605 |
|
606 |
updateControls(); |
607 |
} |
608 |
private void syncLineColor() { |
609 |
lineColorChooserPanel.setColor(fillColorChooserPanel.getColor().darker()); |
610 |
} |
611 |
|
612 |
void fillPatternCheckBox_actionPerformed(ActionEvent e) { |
613 |
updateControls(); |
614 |
} |
615 |
private void updateFillPatternColors() { |
616 |
if ((m_FSymbol != null) && (m_FSymbol.m_Color != null)) |
617 |
{ |
618 |
fillPatterns = FSymbolFactory.createPatternFills(m_FSymbol.m_Color); |
619 |
fillPatternComboBox.setModel(new DefaultComboBoxModel(fillPatterns)); |
620 |
fillPatternComboBox.getModel().setSelectedItem(m_FSymbol.m_Fill); |
621 |
// fillPatternComboBox.setSelectedItem(m_FSymbol.m_Fill);
|
622 |
} |
623 |
|
624 |
} |
625 |
|
626 |
public void updateControls() { |
627 |
linePatternComboBox.setEnabled(linePatternCheckBox.isSelected()); |
628 |
fillPatternComboBox.setEnabled(fillPatternCheckBox.isSelected()); |
629 |
lineColorChooserPanel.setEnabled(lineCheckBox.isSelected()); |
630 |
fillColorChooserPanel.setEnabled(fillCheckBox.isSelected()); |
631 |
fillColorChooserPanel.setAlpha(getAlpha()); |
632 |
lineColorChooserPanel.setAlpha(getAlpha()); |
633 |
Color theColor = (lineCheckBox.isSelected() &&
|
634 |
!fillCheckBox.isSelected()) ? lineColorChooserPanel.getColor() |
635 |
: fillColorChooserPanel.getColor(); |
636 |
transparencyPanel.setColor(theColor); |
637 |
if (jTxtImagen != null) |
638 |
{ |
639 |
jTxtImagen.setVisible(false);
|
640 |
jLblImagen.setVisible(false);
|
641 |
jBtnImagen.setVisible(false);
|
642 |
} |
643 |
if (m_FSymbol != null) |
644 |
{ |
645 |
if (m_FSymbol.m_symbolType == FConstant.SYMBOL_TYPE_POINT)
|
646 |
{ |
647 |
m_FSymbol.m_Size = Integer.parseInt(getJTextField().getText());
|
648 |
|
649 |
//System.out.println("Asigno el m_Size = " + getJTextField().getText());
|
650 |
|
651 |
if (pointTypeComboBox.getSelectedItem() instanceof Integer) |
652 |
{ |
653 |
Integer styleSelected = (Integer) pointTypeComboBox.getSelectedItem(); |
654 |
m_FSymbol.m_Style = styleSelected.intValue(); |
655 |
} |
656 |
else
|
657 |
{ |
658 |
Integer styleSelected = pointTypeToInt((String) pointTypeComboBox.getSelectedItem()); |
659 |
m_FSymbol.m_Style = styleSelected.intValue(); |
660 |
} |
661 |
if (m_FSymbol.m_Style == FConstant.SYMBOL_STYLE_MARKER_IMAGEN)
|
662 |
{ |
663 |
jTxtImagen.setVisible(true);
|
664 |
jLblImagen.setVisible(true);
|
665 |
jBtnImagen.setVisible(true);
|
666 |
if (jTxtImagen.getText().compareTo("") != 0) |
667 |
{ |
668 |
m_FSymbol.m_Icon = new ImageIcon(jTxtImagen.getText()).getImage(); |
669 |
} |
670 |
} |
671 |
m_FSymbol.m_Color = pointColorChooserPanel.getColor(); |
672 |
m_FSymbol.m_bUseSize = getJCheckBox().isSelected(); |
673 |
pointColorChooserPanel.repaint(); |
674 |
m_previewSymbol.setSymbol(m_FSymbol); |
675 |
return;
|
676 |
} |
677 |
m_FSymbol.m_useOutline = lineCheckBox.isSelected(); |
678 |
m_FSymbol.m_outlineColor = lineColorChooserPanel.getColor(); |
679 |
if (fillCheckBox.isSelected())
|
680 |
{ |
681 |
m_FSymbol.m_Color = new Color(theColor.getRed(), |
682 |
theColor.getGreen(), |
683 |
theColor.getBlue(), |
684 |
getAlpha()); |
685 |
} |
686 |
else
|
687 |
{ |
688 |
m_FSymbol.m_Color = null;
|
689 |
} |
690 |
if (fillPatternCheckBox.isSelected())
|
691 |
{ |
692 |
Paint fillAux = (Paint) fillPatternComboBox.getSelectedItem(); |
693 |
if (fillAux != null) |
694 |
{ |
695 |
m_FSymbol.m_Fill = (Paint) fillPatternComboBox.getSelectedItem();
|
696 |
// Rellenamos el m_Style para que luego podamos escribir
|
697 |
// el tipo de relleno que lleva.
|
698 |
m_FSymbol.m_Style = fillPatternComboBox.getSelectedIndex()+3;
|
699 |
//System.out.println("Asigno m_Fill=" + m_FSymbol.m_Fill.toString());
|
700 |
} |
701 |
} |
702 |
else
|
703 |
m_FSymbol.m_Fill = null;
|
704 |
|
705 |
float lineWidth = lineWidthSlider.getValue();
|
706 |
if (linePatternCheckBox.isSelected())
|
707 |
{ |
708 |
String linePattern = (String) linePatternComboBox.getSelectedItem(); |
709 |
// System.out.println(m_FSymbol.m_Stroke.toString());
|
710 |
m_FSymbol.m_Stroke = new BasicStroke(lineWidth, BasicStroke.CAP_ROUND, |
711 |
BasicStroke.JOIN_BEVEL, 1.0f, |
712 |
toArray(linePattern, lineWidth), 0);
|
713 |
|
714 |
m_FSymbol.m_LinePattern = linePattern; |
715 |
} |
716 |
else
|
717 |
{ |
718 |
if (lineWidth <=1) |
719 |
m_FSymbol.m_Stroke = null;
|
720 |
else
|
721 |
m_FSymbol.m_Stroke = new BasicStroke(lineWidth, BasicStroke.CAP_ROUND, |
722 |
BasicStroke.JOIN_BEVEL);
|
723 |
} |
724 |
// System.out.println(fillPatternComboBox.getSelectedItem().toString() + " " + linePatternComboBox.getSelectedItem().toString());
|
725 |
// JOptionPane.showMessageDialog(this,"HOla","Colega", JOptionPane.INFORMATION_MESSAGE);
|
726 |
m_previewSymbol.setSymbol(m_FSymbol); |
727 |
} |
728 |
|
729 |
updateFillPatternColors(); |
730 |
fillPatternComboBox.repaint(); |
731 |
} |
732 |
|
733 |
public void setFSymbol(FSymbol s) |
734 |
{ |
735 |
m_FSymbol = s.cloneSymbol(); |
736 |
m_previewSymbol.setSymbol(m_FSymbol); |
737 |
if (m_FSymbol.m_symbolType == FConstant.SYMBOL_TYPE_FILL)
|
738 |
{ |
739 |
getJPanelPoint().setVisible(false);
|
740 |
getCenterPanel().setVisible(true);
|
741 |
fillCheckBox.setText(Utilities.getMessage(this,"relleno")); |
742 |
synchronizeCheckBox.setVisible(true);
|
743 |
fillPatternCheckBox.setVisible(true);
|
744 |
fillPatternComboBox.setVisible(true);
|
745 |
lineCheckBox.setVisible(true);
|
746 |
lineColorChooserPanel.setVisible(true);
|
747 |
|
748 |
lineCheckBox.setSelected(m_FSymbol.m_useOutline); |
749 |
lineColorChooserPanel.setColor(m_FSymbol.m_outlineColor); |
750 |
if (m_FSymbol.m_Color != null) |
751 |
{ |
752 |
fillCheckBox.setSelected(true);
|
753 |
fillColorChooserPanel.setColor(m_FSymbol.m_Color); |
754 |
setAlpha(m_FSymbol.m_Color.getAlpha()); |
755 |
fillColorChooserPanel.setAlpha(getAlpha()); |
756 |
lineColorChooserPanel.setAlpha(getAlpha()); |
757 |
} |
758 |
else
|
759 |
{ |
760 |
fillCheckBox.setSelected(false);
|
761 |
} |
762 |
|
763 |
linePatternCheckBox.setSelected(false);
|
764 |
if (m_FSymbol.m_Stroke != null) |
765 |
{ |
766 |
BasicStroke aux = (BasicStroke) m_FSymbol.m_Stroke; |
767 |
if (aux.getDashArray() != null) |
768 |
{ |
769 |
linePatternCheckBox.setSelected(true);
|
770 |
linePatternComboBox.setSelectedItem(m_FSymbol.m_LinePattern); |
771 |
} |
772 |
} |
773 |
} |
774 |
if (m_FSymbol.m_symbolType == FConstant.SYMBOL_TYPE_LINE)
|
775 |
{ |
776 |
getJPanelPoint().setVisible(false);
|
777 |
getCenterPanel().setVisible(true);
|
778 |
fillCheckBox.setText(Utilities.getMessage(this,"linea")); // Lo vamos a usar como color de l?nea |
779 |
fillCheckBox.setSelected(true);
|
780 |
synchronizeCheckBox.setVisible(false);
|
781 |
fillPatternCheckBox.setVisible(false);
|
782 |
fillPatternComboBox.setVisible(false);
|
783 |
lineCheckBox.setSelected(true);
|
784 |
lineCheckBox.setVisible(false);
|
785 |
fillColorChooserPanel.setColor(m_FSymbol.m_Color); |
786 |
lineColorChooserPanel.setVisible(false);
|
787 |
if (m_FSymbol.m_Color != null) |
788 |
{ |
789 |
lineColorChooserPanel.setColor(m_FSymbol.m_Color); |
790 |
setAlpha(m_FSymbol.m_Color.getAlpha()); |
791 |
lineColorChooserPanel.setAlpha(getAlpha()); |
792 |
} |
793 |
|
794 |
linePatternCheckBox.setSelected(false);
|
795 |
if (m_FSymbol.m_Stroke != null) |
796 |
{ |
797 |
BasicStroke aux = (BasicStroke) m_FSymbol.m_Stroke; |
798 |
if (aux.getDashArray() != null) |
799 |
{ |
800 |
linePatternCheckBox.setSelected(true);
|
801 |
linePatternComboBox.setSelectedItem(m_FSymbol.m_LinePattern); |
802 |
} |
803 |
} |
804 |
} |
805 |
if (m_FSymbol.m_symbolType == FConstant.SYMBOL_TYPE_POINT)
|
806 |
{ |
807 |
getCenterPanel().setVisible(false);
|
808 |
getJPanelPoint().setVisible(true);
|
809 |
if (m_FSymbol.m_Color!=null){ |
810 |
pointColorChooserPanel.setColor(m_FSymbol.m_Color); |
811 |
} |
812 |
getJTextField().setText("" + m_FSymbol.m_Size);
|
813 |
getJCheckBox().setSelected(m_FSymbol.m_bUseSize); |
814 |
getJComboBox_pointType().setSelectedItem(new Integer(m_FSymbol.m_Style)); |
815 |
|
816 |
} |
817 |
|
818 |
// setAlpha(255 - m_FSymbol.m_Transparency);
|
819 |
|
820 |
} |
821 |
|
822 |
/**
|
823 |
* @return
|
824 |
*/
|
825 |
public FSymbol getFSymbol() {
|
826 |
updateControls(); |
827 |
return m_FSymbol;
|
828 |
} |
829 |
|
830 |
protected void setCenterPanel(JPanel centerPanel) { |
831 |
this.centerPanel = centerPanel;
|
832 |
} |
833 |
|
834 |
protected JPanel getCenterPanel() { |
835 |
return centerPanel;
|
836 |
} |
837 |
|
838 |
/**
|
839 |
|
840 |
* This method initializes jPanel
|
841 |
|
842 |
*
|
843 |
|
844 |
* @return javax.swing.JPanel
|
845 |
|
846 |
*/
|
847 |
private javax.swing.JPanel getJPanelPoint() {
|
848 |
if (jPanelPoint == null) { |
849 |
jLblImagen = new JLabel(); |
850 |
jPanelPoint = new javax.swing.JPanel();
|
851 |
jPanelPoint.setLayout(null);
|
852 |
jPanelPoint.setPreferredSize(new Dimension(300,200)); |
853 |
jPanelPoint.setBounds(0, 2, 336, 217); |
854 |
jLblImagen.setBounds(25, 139, 71, 18); |
855 |
jLblImagen.setText(Utilities.getMessage(this,"imagen")); |
856 |
jPanelPoint.add(getJLabel2(), null);
|
857 |
jPanelPoint.add(getJLabel(), null);
|
858 |
jPanelPoint.add(getJLabel1(), null);
|
859 |
jPanelPoint.add(getJCheckBox(), null);
|
860 |
jPanelPoint.add(getJTextField(), null);
|
861 |
jPanelPoint.add(getJComboBox_pointType(), null);
|
862 |
pointColorChooserPanel.setBounds(143, 54, 98, 22); |
863 |
pointColorChooserPanel.setAlpha(255);
|
864 |
jPanelPoint.add(pointColorChooserPanel); |
865 |
jPanelPoint.add(jLblImagen, null);
|
866 |
jPanelPoint.add(getJTextField2(), null);
|
867 |
jPanelPoint.add(getJBtnImagen(), null);
|
868 |
} |
869 |
return jPanelPoint;
|
870 |
} |
871 |
|
872 |
/**
|
873 |
|
874 |
* This method initializes jLabel
|
875 |
|
876 |
*
|
877 |
|
878 |
* @return javax.swing.JLabel
|
879 |
|
880 |
*/
|
881 |
private javax.swing.JLabel getJLabel() {
|
882 |
if (jLabel == null) { |
883 |
jLabel = new javax.swing.JLabel();
|
884 |
jLabel.setText(Utilities.getMessage(this,"tipo_simbolo")); |
885 |
jLabel.setBounds(25, 23, 113, 22); |
886 |
} |
887 |
return jLabel;
|
888 |
} |
889 |
|
890 |
/**
|
891 |
|
892 |
* This method initializes jLabel1
|
893 |
|
894 |
*
|
895 |
|
896 |
* @return javax.swing.JLabel
|
897 |
|
898 |
*/
|
899 |
private javax.swing.JLabel getJLabel1() {
|
900 |
if (jLabel1 == null) { |
901 |
jLabel1 = new javax.swing.JLabel();
|
902 |
jLabel1.setBounds(25, 84, 77, 22); |
903 |
jLabel1.setText(Utilities.getMessage(this,"tamano")); |
904 |
} |
905 |
return jLabel1;
|
906 |
} |
907 |
|
908 |
/**
|
909 |
|
910 |
* This method initializes jCheckBox
|
911 |
|
912 |
*
|
913 |
|
914 |
* @return javax.swing.JCheckBox
|
915 |
|
916 |
*/
|
917 |
private javax.swing.JCheckBox getJCheckBox() {
|
918 |
if (jCheckBox == null) { |
919 |
jCheckBox = new javax.swing.JCheckBox();
|
920 |
jCheckBox.setBounds(143, 115, 145, 19); |
921 |
jCheckBox.setText(Utilities.getMessage(this,"tamano_metros")); |
922 |
} |
923 |
return jCheckBox;
|
924 |
} |
925 |
|
926 |
/**
|
927 |
|
928 |
* This method initializes jTextField
|
929 |
|
930 |
*
|
931 |
|
932 |
* @return javax.swing.JTextField
|
933 |
|
934 |
*/
|
935 |
private javax.swing.JTextField getJTextField() {
|
936 |
if (jTextField_Size == null) { |
937 |
jTextField_Size = new javax.swing.JTextField();
|
938 |
jTextField_Size.setBounds(143, 86, 76, 20); |
939 |
jTextField_Size.setText("12");
|
940 |
jTextField_Size.addActionListener(new java.awt.event.ActionListener() {
|
941 |
public void actionPerformed(ActionEvent arg0) { |
942 |
updateControls(); |
943 |
} |
944 |
}); |
945 |
} |
946 |
return jTextField_Size;
|
947 |
} |
948 |
|
949 |
/**
|
950 |
|
951 |
* This method initializes jComboBox
|
952 |
|
953 |
*
|
954 |
|
955 |
* @return javax.swing.JComboBox
|
956 |
|
957 |
*/
|
958 |
private javax.swing.JComboBox getJComboBox_pointType() {
|
959 |
if (jComboBox_Symbol_Type == null) { |
960 |
jComboBox_Symbol_Type = new javax.swing.JComboBox();
|
961 |
jComboBox_Symbol_Type.setBounds(143, 25, 120, 20); |
962 |
} |
963 |
// return jComboBox_Symbol_Type;
|
964 |
return pointTypeComboBox;
|
965 |
} |
966 |
|
967 |
/**
|
968 |
|
969 |
* This method initializes jLabel2
|
970 |
|
971 |
*
|
972 |
|
973 |
* @return javax.swing.JLabel
|
974 |
|
975 |
*/
|
976 |
private javax.swing.JLabel getJLabel2() {
|
977 |
if (jLabel2 == null) { |
978 |
jLabel2 = new javax.swing.JLabel();
|
979 |
jLabel2.setBounds(25, 54, 68, 22); |
980 |
jLabel2.setText(Utilities.getMessage(this,"color")); |
981 |
} |
982 |
return jLabel2;
|
983 |
} |
984 |
|
985 |
/**
|
986 |
* This method initializes jTextField
|
987 |
*
|
988 |
* @return javax.swing.JTextField
|
989 |
*/
|
990 |
private JTextField getJTextField2() { |
991 |
if (jTxtImagen == null) { |
992 |
jTxtImagen = new JTextField(); |
993 |
jTxtImagen.setBounds(103, 139, 168, 18); |
994 |
} |
995 |
return jTxtImagen;
|
996 |
} |
997 |
/**
|
998 |
* This method initializes jButton
|
999 |
*
|
1000 |
* @return javax.swing.JButton
|
1001 |
*/
|
1002 |
private JButton getJBtnImagen() { |
1003 |
if (jBtnImagen == null) { |
1004 |
jBtnImagen = new JButton(); |
1005 |
jBtnImagen.setBounds(279, 139, 33, 18); |
1006 |
jBtnImagen.setText("...");
|
1007 |
jBtnImagen.setToolTipText(Utilities.getMessage(this,"browse")); |
1008 |
jBtnImagen.addActionListener(new java.awt.event.ActionListener() {
|
1009 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
1010 |
JFileChooser tempChooser = new JFileChooser(); |
1011 |
ImageFilter filter = new ImageFilter(); |
1012 |
tempChooser.setFileFilter(filter); |
1013 |
|
1014 |
int result = tempChooser.showOpenDialog((Component) e.getSource()); |
1015 |
tempChooser.setMultiSelectionEnabled(false);
|
1016 |
if (result == JFileChooser.APPROVE_OPTION) { |
1017 |
File newFile = tempChooser.getSelectedFile();
|
1018 |
jTxtImagen.setText(newFile.getAbsolutePath()); |
1019 |
} |
1020 |
} |
1021 |
}); |
1022 |
} |
1023 |
return jBtnImagen;
|
1024 |
} |
1025 |
} // @jve:visual-info decl-index=0 visual-constraint="10,10"
|