svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / fframes / gui / dialogs / FFrameTextDialog.java @ 9024
History | View | Annotate | Download (23.5 KB)
1 |
/*
|
---|---|
2 |
* Created on 22-jun-2004
|
3 |
*
|
4 |
*/
|
5 |
/* 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 |
package com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs; |
46 |
|
47 |
import java.awt.Color; |
48 |
import java.awt.Component; |
49 |
import java.awt.Font; |
50 |
import java.awt.event.ActionEvent; |
51 |
import java.awt.geom.Rectangle2D; |
52 |
|
53 |
import javax.swing.ImageIcon; |
54 |
import javax.swing.JButton; |
55 |
import javax.swing.JCheckBox; |
56 |
import javax.swing.JColorChooser; |
57 |
import javax.swing.JDialog; |
58 |
import javax.swing.JLabel; |
59 |
import javax.swing.JPanel; |
60 |
import javax.swing.JTextField; |
61 |
import javax.swing.JToggleButton; |
62 |
|
63 |
import com.iver.andami.PluginServices; |
64 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
65 |
import com.iver.cit.gvsig.AddLayer; |
66 |
import com.iver.cit.gvsig.gui.layout.Layout; |
67 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameText; |
68 |
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel; |
69 |
import com.iver.cit.gvsig.gui.utils.FontChooser; |
70 |
import com.iver.cit.gvsig.project.documents.layout.FLayoutUtilities; |
71 |
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.JPRotation; |
72 |
|
73 |
/**
|
74 |
* Dialogo para a?adir texto al Layout.
|
75 |
*
|
76 |
* @author Vicente Caballero Navarro
|
77 |
*/
|
78 |
public class FFrameTextDialog extends JPanel implements IFFrameDialog { |
79 |
public static final ImageIcon ileft = new ImageIcon(AddLayer.class.getClassLoader() |
80 |
.getResource("images/left.PNG")); //$NON-NLS-1$ |
81 |
public static final ImageIcon icenterV = new ImageIcon(AddLayer.class.getClassLoader() |
82 |
.getResource("images/centerV.PNG")); //$NON-NLS-1$ |
83 |
public static final ImageIcon iright = new ImageIcon(AddLayer.class.getClassLoader() |
84 |
.getResource("images/right.PNG")); //$NON-NLS-1$ |
85 |
private javax.swing.JPanel jContentPane = null; // @jve:visual-info decl-index=0 visual-constraint="593,10" |
86 |
private javax.swing.JScrollPane jScrollPane = null; |
87 |
private javax.swing.JTextArea taTexto = null; |
88 |
private JToggleButton bIzquierda = null; |
89 |
private JToggleButton bCentro = null; |
90 |
private JToggleButton bDerecha = null; |
91 |
private javax.swing.JButton bAceptar = null; |
92 |
private javax.swing.JButton bCancelar = null; |
93 |
private Layout m_layout = null; |
94 |
private Rectangle2D rect = new Rectangle2D.Double(); |
95 |
private FFrameText fframetext = null; //new FFrameText(); |
96 |
private boolean isAcepted = false; |
97 |
private javax.swing.JButton bFuente = null; |
98 |
private Color textcolor = null; |
99 |
private Color frameColor =null; |
100 |
private Color titleColor =null; |
101 |
private JButton jButton = null; |
102 |
private JCheckBox chkSurroundingRectangle = null; |
103 |
private JTextField txtCellPadding = null; |
104 |
private JLabel jLabel = null; |
105 |
private JCheckBox chkFontSize = null; |
106 |
private JTextField txtFontSize = null; |
107 |
private JCheckBox chkTitle = null; |
108 |
private JTextField txtTitle = null; |
109 |
private JPanel jPanel = null; |
110 |
private JTextField txtTitleSize = null; |
111 |
private JLabel jLabel3 = null; |
112 |
private JLabel jLabel4; |
113 |
private JPanel jPanel1 = null; |
114 |
private JTextField txtFrameSize = null; |
115 |
private JLabel jLabel5 = null; |
116 |
private JLabel jLabel6 = null; |
117 |
private JLabel jLabel7 = null; |
118 |
private JPRotation pRotation = null; |
119 |
private ColorChooserPanel m_colorChooser;
|
120 |
private JPanel jPanel2 = null; |
121 |
private JPanel jPanel21 = null; |
122 |
private ColorChooserPanel m_colorFont; // @jve:decl-index=0:visual-constraint="474,139" |
123 |
private ColorChooserPanel m_colorTitle;
|
124 |
/**
|
125 |
* This is the default constructor
|
126 |
*
|
127 |
* @param layout Referencia al Layout.
|
128 |
* @param fframe Referencia al fframe de texto.
|
129 |
*/
|
130 |
public FFrameTextDialog(Layout layout, FFrameText fframe) {
|
131 |
super();
|
132 |
fframetext = fframe; |
133 |
m_layout = layout; |
134 |
textcolor = fframe.getTextColor(); |
135 |
frameColor = fframe.getFrameColor(); |
136 |
titleColor = fframe.getTitleColor(); |
137 |
initialize(); |
138 |
} |
139 |
|
140 |
/**
|
141 |
* This method initializes this
|
142 |
*/
|
143 |
private void initialize() { |
144 |
this.setLayout(null); |
145 |
this.add(getJContentPane(), null); |
146 |
this.setSize(419, 429); |
147 |
getPRotation().setRotation(fframetext.getRotation()); |
148 |
} |
149 |
|
150 |
/**
|
151 |
* Inserta el rect?ngulo a ocupar por el fframe de texto.
|
152 |
*
|
153 |
* @param r Rect?ngulo.
|
154 |
*/
|
155 |
public void setRectangle(Rectangle2D r) { |
156 |
rect.setRect(r); |
157 |
} |
158 |
|
159 |
/**
|
160 |
* This method initializes jContentPane
|
161 |
*
|
162 |
* @return javax.swing.JPanel
|
163 |
*/
|
164 |
private javax.swing.JPanel getJContentPane() {
|
165 |
if (jContentPane == null) { |
166 |
jLabel = new JLabel(); |
167 |
jContentPane = new javax.swing.JPanel();
|
168 |
jContentPane.setLayout(null);
|
169 |
jContentPane.add(getJScrollPane(), null);
|
170 |
//jContentPane.add(getJComboBox(), null);
|
171 |
//jContentPane.add(getJLabel2(), null);
|
172 |
jContentPane.add(getBAceptar(), null);
|
173 |
jContentPane.add(getBCancelar(), null);
|
174 |
jContentPane.add(getBFuente(), null);
|
175 |
jContentPane.add(getColorFont(),null);
|
176 |
jContentPane.setSize(412, 422); |
177 |
jContentPane.setLocation(3, 4); |
178 |
// jaume
|
179 |
jLabel.setText(PluginServices.getText(this, "Milimetros")); |
180 |
jLabel.setSize(110, 16); |
181 |
jLabel.setLocation(244, 74); |
182 |
jContentPane.add(getJPanel1(), null);
|
183 |
jContentPane.add(getJPanel(), null);
|
184 |
jContentPane.add(getChkFontSize(), null);
|
185 |
jContentPane.add(getTxtFontSize(), null);
|
186 |
jContentPane.add(getPRotation(), null);
|
187 |
jContentPane.add(getJPanel21(), null);
|
188 |
} |
189 |
|
190 |
return jContentPane;
|
191 |
} |
192 |
|
193 |
/**
|
194 |
* This method initializes jScrollPane
|
195 |
*
|
196 |
* @return javax.swing.JScrollPane
|
197 |
*/
|
198 |
private javax.swing.JScrollPane getJScrollPane() {
|
199 |
if (jScrollPane == null) { |
200 |
jScrollPane = new javax.swing.JScrollPane();
|
201 |
jScrollPane.setViewportView(getTaTexto()); |
202 |
jScrollPane.setSize(261, 83); |
203 |
jScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
204 |
jScrollPane.setLocation(5, 5); |
205 |
} |
206 |
|
207 |
return jScrollPane;
|
208 |
} |
209 |
|
210 |
/**
|
211 |
* This method initializes taTexto
|
212 |
*
|
213 |
* @return javax.swing.JTextArea
|
214 |
*/
|
215 |
private javax.swing.JTextArea getTaTexto() {
|
216 |
if (taTexto == null) { |
217 |
taTexto = new javax.swing.JTextArea();
|
218 |
|
219 |
for (int i = 0; i < fframetext.getText().size(); i++) { |
220 |
if (!((String) fframetext.getText().get(i)).equals("")) { //$NON-NLS-1$ |
221 |
taTexto.append((String) fframetext.getText().get(i));
|
222 |
} |
223 |
} |
224 |
} |
225 |
|
226 |
return taTexto;
|
227 |
} |
228 |
|
229 |
/**
|
230 |
* This method initializes bIzquierda
|
231 |
*
|
232 |
* @return javax.swing.JButton
|
233 |
*/
|
234 |
private JToggleButton getBIzquierda() { |
235 |
if (bIzquierda == null) { |
236 |
bIzquierda = new JToggleButton(); |
237 |
bIzquierda.setPreferredSize(new java.awt.Dimension(28, 20)); |
238 |
if (fframetext.getPos() == FFrameText.LEFT) {
|
239 |
bIzquierda.setSelected(true);
|
240 |
} |
241 |
|
242 |
bIzquierda.setIcon(ileft); |
243 |
bIzquierda.addActionListener(new java.awt.event.ActionListener() {
|
244 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
245 |
fframetext.setPos(FFrameText.LEFT); |
246 |
getBIzquierda().setSelected(true);
|
247 |
getBCentro().setSelected(false);
|
248 |
getBDerecha().setSelected(false);
|
249 |
} |
250 |
}); |
251 |
} |
252 |
|
253 |
return bIzquierda;
|
254 |
} |
255 |
|
256 |
/**
|
257 |
* This method initializes bCentro
|
258 |
*
|
259 |
* @return javax.swing.JButton
|
260 |
*/
|
261 |
private JToggleButton getBCentro() { |
262 |
if (bCentro == null) { |
263 |
bCentro = new JToggleButton(); |
264 |
bCentro.setPreferredSize(new java.awt.Dimension(28, 20)); |
265 |
if (fframetext.getPos() == FFrameText.CENTER) {
|
266 |
bCentro.setSelected(true);
|
267 |
} |
268 |
|
269 |
bCentro.setIcon(icenterV); |
270 |
bCentro.addActionListener(new java.awt.event.ActionListener() {
|
271 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
272 |
fframetext.setPos(FFrameText.CENTER); |
273 |
getBIzquierda().setSelected(false);
|
274 |
getBCentro().setSelected(true);
|
275 |
getBDerecha().setSelected(false);
|
276 |
} |
277 |
}); |
278 |
} |
279 |
|
280 |
return bCentro;
|
281 |
} |
282 |
|
283 |
/**
|
284 |
* This method initializes bDerecha
|
285 |
*
|
286 |
* @return javax.swing.JButton
|
287 |
*/
|
288 |
private JToggleButton getBDerecha() { |
289 |
if (bDerecha == null) { |
290 |
bDerecha = new JToggleButton(); |
291 |
bDerecha.setPreferredSize(new java.awt.Dimension(28, 20)); |
292 |
if (fframetext.getPos() == FFrameText.RIGTH) {
|
293 |
bDerecha.setSelected(true);
|
294 |
} |
295 |
|
296 |
bDerecha.setIcon(iright); |
297 |
bDerecha.addActionListener(new java.awt.event.ActionListener() {
|
298 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
299 |
fframetext.setPos(FFrameText.RIGTH); |
300 |
getBIzquierda().setSelected(false);
|
301 |
getBCentro().setSelected(false);
|
302 |
getBDerecha().setSelected(true);
|
303 |
} |
304 |
}); |
305 |
} |
306 |
|
307 |
return bDerecha;
|
308 |
} |
309 |
|
310 |
/**
|
311 |
* This method initializes bAceptar
|
312 |
*
|
313 |
* @return javax.swing.JButton
|
314 |
*/
|
315 |
private javax.swing.JButton getBAceptar() {
|
316 |
if (bAceptar == null) { |
317 |
bAceptar = new javax.swing.JButton();
|
318 |
bAceptar.setSize(79, 26); |
319 |
bAceptar.setText(PluginServices.getText(this, "Aceptar")); //$NON-NLS-1$ |
320 |
bAceptar.setLocation(39, 388); |
321 |
bAceptar.addActionListener(new java.awt.event.ActionListener() {
|
322 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
323 |
fframetext.setBoundBox(FLayoutUtilities.toSheetRect( |
324 |
rect, m_layout.getAT())); |
325 |
fframetext.getText().clear(); |
326 |
|
327 |
for (int i = 0; i < getTaTexto().getLineCount(); i++) { |
328 |
try {
|
329 |
String s = getTaTexto().getText(getTaTexto()
|
330 |
.getLineStartOffset(i), |
331 |
getTaTexto().getLineEndOffset(i) - |
332 |
getTaTexto().getLineStartOffset(i)); |
333 |
|
334 |
if (!s.equals("")) { //$NON-NLS-1$ |
335 |
fframetext.addText(s); |
336 |
} |
337 |
} catch (Exception ex) { |
338 |
} |
339 |
} |
340 |
fframetext.setTextColor(textcolor); |
341 |
//fframetext.setSizeFixed(!getChkEscalaVista().isSelected());
|
342 |
|
343 |
// jaume
|
344 |
boolean b = getChkSurroundingRectangle().isSelected();
|
345 |
fframetext.setSurrounded(getChkSurroundingRectangle().isSelected()); |
346 |
|
347 |
if (b){
|
348 |
// Hay rect?ngulo
|
349 |
fframetext.setCellPadding(Double.parseDouble(getTxtCellPadding().getText())/100); |
350 |
double i;
|
351 |
try{
|
352 |
i = Double.parseDouble(getTxtFrameSize().getText());
|
353 |
} catch (Exception ex){ |
354 |
i = 0;
|
355 |
} |
356 |
if (i==0) i = 1; |
357 |
fframetext.setFrameBorderSize(i/100);
|
358 |
fframetext.setFrameColor(frameColor); |
359 |
} |
360 |
b=getChkFontSize().isSelected(); |
361 |
fframetext.setFixedFontSize(b); |
362 |
|
363 |
if (b){
|
364 |
// El tama?o de la fuente es fijo
|
365 |
int i;
|
366 |
try{
|
367 |
i = Integer.parseInt(getTxtFontSize().getText());
|
368 |
} catch (Exception ex){ |
369 |
i = 12;
|
370 |
} |
371 |
fframetext.setFontSize(i); |
372 |
} |
373 |
b=getChkTitle().isSelected(); |
374 |
fframetext.setHasTitle(b); |
375 |
if (b){
|
376 |
// Hay t?tulo
|
377 |
fframetext.setTitle(getTxtTitle().getText()); |
378 |
int i;
|
379 |
try{
|
380 |
i = Integer.parseInt(getTxtTitleSize().getText());
|
381 |
} catch (Exception ex){ |
382 |
i = 12;
|
383 |
} |
384 |
fframetext.setTitleSize(i); |
385 |
|
386 |
fframetext.setTitleColor(titleColor); |
387 |
} |
388 |
|
389 |
fframetext.setRotation(getPRotation().getRotation()); |
390 |
PluginServices.getMDIManager().closeWindow(FFrameTextDialog.this); |
391 |
m_layout.refresh(); |
392 |
isAcepted = true;
|
393 |
} |
394 |
}); |
395 |
} |
396 |
|
397 |
return bAceptar;
|
398 |
} |
399 |
|
400 |
/**
|
401 |
* This method initializes bCancelar
|
402 |
*
|
403 |
* @return javax.swing.JButton
|
404 |
*/
|
405 |
private javax.swing.JButton getBCancelar() {
|
406 |
if (bCancelar == null) { |
407 |
bCancelar = new javax.swing.JButton();
|
408 |
bCancelar.setSize(85, 26); |
409 |
bCancelar.setText(PluginServices.getText(this, "Cancelar")); //$NON-NLS-1$ |
410 |
bCancelar.setLocation(144, 388); |
411 |
bCancelar.addActionListener(new java.awt.event.ActionListener() {
|
412 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
413 |
PluginServices.getMDIManager().closeWindow(FFrameTextDialog.this); |
414 |
} |
415 |
}); |
416 |
} |
417 |
|
418 |
return bCancelar;
|
419 |
} |
420 |
|
421 |
/* (non-Javadoc)
|
422 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
423 |
*/
|
424 |
public WindowInfo getWindowInfo() {
|
425 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
426 |
|
427 |
//vi.setResizable(false);
|
428 |
m_viewinfo.setTitle(PluginServices.getText(this, "Propiedades_texto")); //$NON-NLS-1$ |
429 |
|
430 |
return m_viewinfo;
|
431 |
} |
432 |
|
433 |
/**
|
434 |
* @see com.iver.cit.gvsig.gui.layout.fframes.dialogs.IFFrameDialog#getIsAcepted()
|
435 |
*/
|
436 |
public boolean getIsAcepted() { |
437 |
return isAcepted;
|
438 |
} |
439 |
|
440 |
/**
|
441 |
* This method initializes bFuente
|
442 |
*
|
443 |
* @return javax.swing.JButton
|
444 |
*/
|
445 |
private javax.swing.JButton getBFuente() {
|
446 |
if (bFuente == null) { |
447 |
bFuente = new javax.swing.JButton();
|
448 |
bFuente.setBounds(158, 98, 78, 24); |
449 |
bFuente.setText(PluginServices.getText(this, "fuente")); //$NON-NLS-1$ |
450 |
bFuente.addActionListener(new java.awt.event.ActionListener() {
|
451 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
452 |
Font font=FontChooser.showDialog(
|
453 |
PluginServices.getText(this, "__seleccion_de_fuente"), fframetext.getFont()); |
454 |
if (font!=null) |
455 |
fframetext.setFont(font); // fchoser=new FontChooser(); //$NON-NLS-1$
|
456 |
} |
457 |
}); |
458 |
} |
459 |
|
460 |
return bFuente;
|
461 |
} |
462 |
|
463 |
/**
|
464 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
465 |
*/
|
466 |
public void viewActivated() { |
467 |
} |
468 |
|
469 |
/**
|
470 |
* This method initializes chbSurroundingRectangle
|
471 |
*
|
472 |
* @return javax.swing.JCheckBox
|
473 |
* @author jaume
|
474 |
*/
|
475 |
private JCheckBox getChkSurroundingRectangle() { |
476 |
if (chkSurroundingRectangle == null) { |
477 |
chkSurroundingRectangle = new JCheckBox(); |
478 |
chkSurroundingRectangle.setText(PluginServices.getText(this, "usar_marco")); |
479 |
chkSurroundingRectangle.setSelected(fframetext.isSurrounded()); |
480 |
chkSurroundingRectangle.setBounds(34, 20, 122, 19); |
481 |
chkSurroundingRectangle.addItemListener(new java.awt.event.ItemListener() {
|
482 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
483 |
getTxtCellPadding().setEnabled(getChkSurroundingRectangle().isSelected()); |
484 |
getTxtFrameSize().setEnabled(getChkSurroundingRectangle().isSelected()); |
485 |
} |
486 |
}); |
487 |
} |
488 |
return chkSurroundingRectangle;
|
489 |
} |
490 |
/**
|
491 |
* This method initializes txtCellPadding
|
492 |
*
|
493 |
* @author jaume
|
494 |
*
|
495 |
* @return javax.swing.JTextField
|
496 |
*/
|
497 |
private JTextField getTxtCellPadding() { |
498 |
if (txtCellPadding == null) { |
499 |
txtCellPadding = new JTextField(); |
500 |
txtCellPadding.setEnabled(fframetext.isSurrounded()); |
501 |
txtCellPadding.setText(fframetext.getCellPadding()*100+""); |
502 |
txtCellPadding.setSize(60, 20); |
503 |
txtCellPadding.setLocation(149, 74); |
504 |
txtCellPadding.addKeyListener(new java.awt.event.KeyAdapter() {
|
505 |
public void keyReleased(java.awt.event.KeyEvent e) { |
506 |
ensureInteger(txtCellPadding); |
507 |
} |
508 |
}); |
509 |
|
510 |
} |
511 |
return txtCellPadding;
|
512 |
} |
513 |
/**
|
514 |
* This method initializes chkFontSize
|
515 |
*
|
516 |
* @return javax.swing.JCheckBox
|
517 |
*/
|
518 |
private JCheckBox getChkFontSize() { |
519 |
if (chkFontSize == null) { |
520 |
chkFontSize = new JCheckBox(); |
521 |
chkFontSize.setBounds(7, 160, 143, 19); |
522 |
chkFontSize.setText(PluginServices.getText(this, "tamanyo_fuente")); |
523 |
chkFontSize.setSelected(fframetext.isFontSizeFixed()); |
524 |
chkFontSize.addItemListener(new java.awt.event.ItemListener() {
|
525 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
526 |
getTxtFontSize().setEnabled(getChkFontSize().isSelected()); |
527 |
} |
528 |
}); |
529 |
} |
530 |
return chkFontSize;
|
531 |
} |
532 |
/**
|
533 |
* This method initializes txtFontSize
|
534 |
*
|
535 |
* @return javax.swing.JTextField
|
536 |
*/
|
537 |
private JTextField getTxtFontSize() { |
538 |
if (txtFontSize == null) { |
539 |
txtFontSize = new JTextField(); |
540 |
txtFontSize.setBounds(158, 162, 60, 17); |
541 |
txtFontSize.setEnabled(fframetext.isFontSizeFixed()); |
542 |
if (txtFontSize.isEnabled()) txtFontSize.setText(fframetext.getFontSize()+""); |
543 |
txtFontSize.addKeyListener(new java.awt.event.KeyAdapter() {
|
544 |
public void keyReleased(java.awt.event.KeyEvent e) { |
545 |
ensureInteger(txtFontSize); |
546 |
} |
547 |
}); |
548 |
} |
549 |
return txtFontSize;
|
550 |
} |
551 |
/**
|
552 |
* This method initializes chkTitle2
|
553 |
*
|
554 |
* @return javax.swing.JCheckBox
|
555 |
*/
|
556 |
private JCheckBox getChkTitle() { |
557 |
if (chkTitle == null) { |
558 |
chkTitle = new JCheckBox(); |
559 |
chkTitle.setText(PluginServices.getText(this, "usar_titulo")); |
560 |
chkTitle.setSelected(fframetext.hasTitle()); |
561 |
chkTitle.setBounds(36, 17, 118, 19); |
562 |
chkTitle.addChangeListener(new javax.swing.event.ChangeListener() {
|
563 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
564 |
getTxtTitle().setEnabled(chkTitle.isSelected()); |
565 |
getTxtTitleSize().setEnabled(chkTitle.isSelected()); |
566 |
jLabel3.setEnabled(chkTitle.isSelected()); |
567 |
} |
568 |
}); |
569 |
} |
570 |
return chkTitle;
|
571 |
} |
572 |
/**
|
573 |
* This method initializes txtTitle
|
574 |
*
|
575 |
* @return javax.swing.JTextField
|
576 |
*/
|
577 |
private JTextField getTxtTitle() { |
578 |
if (txtTitle == null) { |
579 |
txtTitle = new JTextField(); |
580 |
txtTitle.setEnabled(fframetext.hasTitle()); |
581 |
if (fframetext.hasTitle())
|
582 |
txtTitle.setText(fframetext.getTitle()); |
583 |
txtTitle.setBounds(35, 39, 254, 20); |
584 |
} |
585 |
return txtTitle;
|
586 |
} |
587 |
/**
|
588 |
* This method initializes jPanel
|
589 |
*
|
590 |
* @return javax.swing.JPanel
|
591 |
*/
|
592 |
private JPanel getJPanel() { |
593 |
if (jPanel == null) { |
594 |
jPanel = new JPanel(); |
595 |
jLabel3 = new JLabel(); |
596 |
jPanel.setLayout(null);
|
597 |
jPanel.setBounds(4, 294, 403, 89); |
598 |
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
599 |
null, PluginServices.getText(this, "titulo_fframetext"), |
600 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
601 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
602 |
jLabel3.setBounds(35, 64, 170, 20); |
603 |
jLabel3.setText(PluginServices.getText(this, "tamanyo_fuente")); |
604 |
jLabel3.setEnabled(fframetext.hasTitle()); |
605 |
jPanel.add(getTxtTitleSize(), null);
|
606 |
jPanel.add(jLabel3, null);
|
607 |
jPanel.add(getChkTitle(), null);
|
608 |
jPanel.add(getTxtTitle(), null);
|
609 |
jLabel4 = new JLabel(); |
610 |
jLabel4.setBounds(245, 64, 96, 20); |
611 |
jPanel.add(jLabel4, null);
|
612 |
jLabel4.setText(PluginServices.getText(this, "pixeles")); |
613 |
jPanel.add(getColorTitle(), null);
|
614 |
} |
615 |
return jPanel;
|
616 |
} |
617 |
/**
|
618 |
* This method initializes txtTitleSize
|
619 |
*
|
620 |
* @return javax.swing.JTextField
|
621 |
*/
|
622 |
private JTextField getTxtTitleSize() { |
623 |
if (txtTitleSize == null) { |
624 |
txtTitleSize = new JTextField(); |
625 |
txtTitleSize.setBounds(146, 65, 60, 20); |
626 |
txtTitleSize.setEnabled(fframetext.hasTitle()); |
627 |
int i = fframetext.getTitleSize();
|
628 |
if (i == 0 && !txtTitleSize.isEnabled()) i = 5; |
629 |
txtTitleSize.setText(i+"");
|
630 |
txtTitleSize.addKeyListener(new java.awt.event.KeyAdapter() {
|
631 |
public void keyReleased(java.awt.event.KeyEvent e) { |
632 |
ensureInteger(txtTitleSize); |
633 |
} |
634 |
}); |
635 |
} |
636 |
return txtTitleSize;
|
637 |
} |
638 |
|
639 |
/**
|
640 |
* Asegura cutremente que no se meten valores que no sean.
|
641 |
* El funcionamiento consiste en si el ?ltimo car?cter escrito
|
642 |
* no vale para formar un int entonces se elimina.
|
643 |
*
|
644 |
* enteros.
|
645 |
* @param tf
|
646 |
*/
|
647 |
private void ensureInteger(JTextField tf){ |
648 |
String s = tf.getText();
|
649 |
try {
|
650 |
Integer.parseInt(s);
|
651 |
} catch (Exception e){ |
652 |
if (s.length()!=0) |
653 |
tf.setText(s.substring(0, s.length()-1)); |
654 |
else tf.setText(""); |
655 |
} |
656 |
} |
657 |
/**
|
658 |
* This method initializes jPanel1
|
659 |
*
|
660 |
* @return javax.swing.JPanel
|
661 |
*/
|
662 |
private JPanel getJPanel1() { |
663 |
if (jPanel1 == null) { |
664 |
jPanel1 = new JPanel(); |
665 |
jLabel5 = new JLabel(); |
666 |
jLabel6 = new JLabel(); |
667 |
jLabel7 = new JLabel(); |
668 |
jPanel1.setLayout(null);
|
669 |
jPanel1.setBounds(5, 185, 403, 106); |
670 |
jPanel1.add(getTxtCellPadding(), null);
|
671 |
jPanel1.add(getChkSurroundingRectangle(), null);
|
672 |
jPanel1.add(jLabel, null);
|
673 |
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( |
674 |
null, PluginServices.getText(this, "marco"), |
675 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
676 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
677 |
jLabel5.setText(PluginServices.getText(this, "Milimetros")); |
678 |
jLabel5.setLocation(244, 46); |
679 |
jLabel5.setSize(110, 16); |
680 |
jLabel5.setPreferredSize(new java.awt.Dimension(40,16)); |
681 |
jLabel6.setBounds(34, 47, 204, 20); |
682 |
jLabel6.setText(PluginServices.getText(this, "tamanyo_borde")); |
683 |
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); |
684 |
jLabel7.setBounds(34, 73, 202, 20); |
685 |
jLabel7.setText(PluginServices.getText(this, "margenes")); |
686 |
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); |
687 |
jPanel1.add(getTxtFrameSize(), null);
|
688 |
jPanel1.add(jLabel6, null);
|
689 |
jPanel1.add(jLabel7, null);
|
690 |
jPanel1.add(jLabel5, null);
|
691 |
//jPanel1.add(getColorFrame(), null);
|
692 |
jPanel1.add(getColorFrame(), null);
|
693 |
jPanel1.add(getColorFrame(), null);
|
694 |
} |
695 |
return jPanel1;
|
696 |
} |
697 |
/**
|
698 |
* This method initializes txtFrameSize
|
699 |
*
|
700 |
* @return javax.swing.JTextField
|
701 |
*/
|
702 |
private JTextField getTxtFrameSize() { |
703 |
if (txtFrameSize == null) { |
704 |
txtFrameSize = new JTextField(); |
705 |
txtFrameSize.setEnabled(fframetext.isSurrounded()); |
706 |
//if (txtFrameSize.isEnabled()){
|
707 |
double i = fframetext.getFrameBorderSize()*100; |
708 |
if (i==0) i = 1; |
709 |
txtFrameSize.setText(i+"");
|
710 |
//}
|
711 |
txtFrameSize.setLocation(149, 47); |
712 |
txtFrameSize.setSize(60, 20); |
713 |
} |
714 |
return txtFrameSize;
|
715 |
} |
716 |
/**
|
717 |
* This method initializes jButton1
|
718 |
*
|
719 |
* @return javax.swing.JButton
|
720 |
*/
|
721 |
private ColorChooserPanel getColorFrame() {
|
722 |
if (m_colorChooser==null) { |
723 |
m_colorChooser=new ColorChooserPanel();
|
724 |
m_colorChooser.setAlpha(255);
|
725 |
m_colorChooser.setBounds(new java.awt.Rectangle(155,15,80,25)); |
726 |
m_colorChooser.addActionListener(new java.awt.event.ActionListener() {
|
727 |
public void actionPerformed(ActionEvent e) { |
728 |
frameColor = m_colorChooser.getColor(); |
729 |
} |
730 |
}); |
731 |
} |
732 |
return m_colorChooser;
|
733 |
} |
734 |
/**
|
735 |
* This method initializes jButton1
|
736 |
*
|
737 |
* @return javax.swing.JButton
|
738 |
*/
|
739 |
private ColorChooserPanel getColorFont() {
|
740 |
if (m_colorFont==null) { |
741 |
m_colorFont=new ColorChooserPanel();
|
742 |
m_colorFont.setAlpha(255);
|
743 |
m_colorFont.setLocation(new java.awt.Point(158,129)); |
744 |
m_colorFont.setSize(new java.awt.Dimension(80,25)); |
745 |
m_colorFont.addActionListener(new java.awt.event.ActionListener() {
|
746 |
public void actionPerformed(ActionEvent e) { |
747 |
textcolor = m_colorFont.getColor(); |
748 |
} |
749 |
}); |
750 |
} |
751 |
return m_colorFont;
|
752 |
} |
753 |
/**
|
754 |
* This method initializes jButton1
|
755 |
*
|
756 |
* @return javax.swing.JButton
|
757 |
*/
|
758 |
private ColorChooserPanel getColorTitle() {
|
759 |
if (m_colorTitle==null) { |
760 |
m_colorTitle=new ColorChooserPanel();
|
761 |
m_colorTitle.setAlpha(255);
|
762 |
m_colorTitle.setBounds(new java.awt.Rectangle(155,11,80,25)); |
763 |
m_colorTitle.addActionListener(new java.awt.event.ActionListener() {
|
764 |
public void actionPerformed(ActionEvent e) { |
765 |
titleColor = m_colorTitle.getColor(); |
766 |
} |
767 |
}); |
768 |
} |
769 |
return m_colorTitle;
|
770 |
} |
771 |
/**
|
772 |
* This method initializes pRotation
|
773 |
*
|
774 |
* @return javax.swing.JPanel
|
775 |
*/
|
776 |
private JPRotation getPRotation() {
|
777 |
if (pRotation == null) { |
778 |
pRotation = new JPRotation();
|
779 |
pRotation.setBounds(281, 0, 125, 131); |
780 |
} |
781 |
return pRotation;
|
782 |
} |
783 |
|
784 |
/**
|
785 |
* This method initializes jPanel21
|
786 |
*
|
787 |
* @return javax.swing.JPanel
|
788 |
*/
|
789 |
private JPanel getJPanel21() { |
790 |
if (jPanel21 == null) { |
791 |
jPanel21 = new JPanel(); |
792 |
jPanel21.setBounds(new java.awt.Rectangle(6,95,126,60)); |
793 |
jPanel21.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this, "alinear"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
794 |
jPanel21.add(getBIzquierda(), null);
|
795 |
jPanel21.add(getBCentro(), null);
|
796 |
jPanel21.add(getBDerecha(), null);
|
797 |
} |
798 |
return jPanel21;
|
799 |
} |
800 |
|
801 |
|
802 |
} // @jve:decl-index=0:visual-constraint="10,10"
|