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