Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / utils / FontChooser.java @ 7304

History | View | Annotate | Download (22.9 KB)

1
/*
2
 * Created on 02-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.gui.utils;
46

    
47
/*
48
 * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI 
49
 * for visualizing and manipulating spatial features with geometry and attributes.
50
 *
51
 * Copyright (C) 2003 Vivid Solutions
52
 * 
53
 * This program is free software; you can redistribute it and/or
54
 * modify it under the terms of the GNU General Public License
55
 * as published by the Free Software Foundation; either version 2
56
 * of the License, or (at your option) any later version.
57
 * 
58
 * This program is distributed in the hope that it will be useful,
59
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
60
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
61
 * GNU General Public License for more details.
62
 * 
63
 * You should have received a copy of the GNU General Public License
64
 * along with this program; if not, write to the Free Software
65
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
66
 * 
67
 * For more information, contact:
68
 *
69
 * Vivid Solutions
70
 * Suite #1A
71
 * 2328 Government Street
72
 * Victoria BC  V8T 5G5
73
 * Canada
74
 *
75
 * (250)385-6040
76
 * www.vividsolutions.com
77
 */
78

    
79

    
80
import java.awt.Font;
81
import java.awt.GraphicsEnvironment;
82
import java.awt.GridBagConstraints;
83
import java.awt.Insets;
84
import java.awt.event.KeyEvent;
85
import java.util.StringTokenizer;
86

    
87
import javax.swing.DefaultListModel;
88
import javax.swing.JList;
89
import javax.swing.JPanel;
90
import javax.swing.JScrollPane;
91

    
92
import com.iver.andami.PluginServices;
93
import com.iver.andami.Utilities;
94
import com.iver.andami.ui.mdiManager.IWindow;
95
import com.iver.andami.ui.mdiManager.WindowInfo;
96

    
97

    
98
/**
99
 * Based on FontChooser by Janos Szatmary. Posted on the Sun Java forums.
100
 *
101
 * Szatmary, Janos. "A FontChooser Class (source included)." April 2001.
102
 * Available from http://forum.java.sun.com/thread.jsp?forum=57&thread=124810.
103
 * Internet; accessed 6 November 2002.
104
 *
105
*/
106
public class FontChooser extends JPanel implements IWindow{
107
    private String sampleText = "The quick brown fox jumped over the lazy dog.";
108
    String[] styleList = new String[] { PluginServices.getText(this,"Plain"),
109
                    PluginServices.getText(this,"Bold"), PluginServices.getText(this,"Italic") };
110
    String[] sizeList = new String[] {
111
            "2", "4", "6", "8", "10", "12", "14", "16", "18", "20", "22", "24",
112
            "30", "36", "48", "72"
113
        };
114
    String currentFont = null;
115
    int currentStyle = -1;
116
    int currentSize = -1;
117
    public boolean ok = false;
118

    
119
    // Variables declaration - do not modify
120
    private javax.swing.JPanel jPanel3;
121
    private javax.swing.JTextField jFont;
122
    private javax.swing.JScrollPane jScrollPane1;
123
    private javax.swing.JList jFontList;
124
    private javax.swing.JPanel jPanel4;
125
    private javax.swing.JTextField jStyle;
126
    private javax.swing.JScrollPane jScrollPane2;
127
    private javax.swing.JList jStyleList;
128
    private javax.swing.JPanel jPanel5;
129
    private javax.swing.JTextField jSize;
130
    private javax.swing.JScrollPane jScrollPane3;
131
    private javax.swing.JList jSizeList;
132
    private javax.swing.JPanel jPanel1;
133
    private javax.swing.JScrollPane jScrollPane4;
134
    private javax.swing.JTextArea jSample;
135
    private javax.swing.JPanel jButtons;
136
    private javax.swing.JButton jOk;
137
    private javax.swing.JButton jCancel;
138
    private javax.swing.JLabel jLabel6;
139
        private String m_title;
140
        /* ------------------------------------------------------------- */
141
    private FontChooser() {
142
        //super(parent, modal);
143
        jbInit();
144
        setListValues(jFontList,
145
            GraphicsEnvironment.getLocalGraphicsEnvironment()
146
                               .getAvailableFontFamilyNames());
147
        setListValues(jStyleList, styleList);
148
        setListValues(jSizeList, sizeList);
149
        setCurrentFont(jSample.getFont());
150
       // pack();
151
    }
152

    
153
    private FontChooser(Font font) {
154
        this();
155
        setCurrentFont(font);
156
    }
157

    
158
    /* ------------------------------------------------------------- */
159
    private void setListValues(JList list, String[] values) {
160
        if (list.getModel() instanceof DefaultListModel) {
161
            DefaultListModel model = (DefaultListModel) list.getModel();
162
            model.removeAllElements();
163

    
164
            for (int j = 0; j < values.length; j++) {
165
                model.addElement(values[j]);
166
            }
167
        }
168
    }
169

    
170
    /* ------------------------------------------------------------- */
171
    private void setSampleFont() {
172
        if ((currentFont != null) && (currentStyle >= 0) && (currentSize > 0)) {
173
            jSample.setFont(new Font(currentFont, currentStyle, currentSize));
174
        }
175
    }
176

    
177
    private String styleToString(int style) {
178
        String str = "";
179

    
180
        if ((style & Font.BOLD) == Font.BOLD) {
181
            if (str.length() > 0) {
182
                str += ",";
183
            }
184

    
185
            str += PluginServices.getText(this,"Bold");
186
        }
187

    
188
        if ((style & Font.ITALIC) == Font.ITALIC) {
189
            if (str.length() > 0) {
190
                str += ",";
191
            }
192

    
193
            str += PluginServices.getText(this,"Italic");
194
        }
195

    
196
        if ((str.length() <= 0) && ((style & Font.PLAIN) == Font.PLAIN)) {
197
            str = PluginServices.getText(this,"Plain");
198
        }
199

    
200
        return str;
201
    }
202

    
203
    /* ------------------------------------------------------------- */
204
    public Font getCurrentFont() {
205
        return jSample.getFont();
206
    }
207

    
208
    /* ------------------------------------------------------------- */
209
    public void setCurrentFont(Font font) {
210
        if (font == null) {
211
            font = jSample.getFont();
212
        }
213
                
214
        jFont.setText(font.getName());
215
        jFontActionPerformed(null);
216

    
217
        jStyle.setText(styleToString(font.getStyle()));
218
        jStyleActionPerformed(null);
219

    
220
        jSize.setText(Integer.toString(font.getSize()));
221
        jSizeActionPerformed(null);
222
    }
223

    
224
    /* ------------------------------------------------------------- */
225
    public static Font showDialog(String title, Font font) {
226
        FontChooser dialog = new FontChooser(font);
227
        PluginServices.getMDIManager().addWindow(dialog);
228
        /*Point p1 = parent.getLocation();
229
        Dimension d1 = parent.getSize();
230
        Dimension d2 = dialog.getSize();
231

232
        int x = p1.x + ((d1.width - d2.width) / 2);
233
        int y = p1.y + ((d1.height - d2.height) / 2);
234

235
        if (x < 0) {
236
            x = 0;
237
        }
238

239
        if (y < 0) {
240
            y = 0;
241
        }
242
*/
243
        if (title != null) {
244
            dialog.m_title=title;
245
        }
246

    
247
      //  dialog.setLocation(x, y);
248
      //  dialog.setVisible(true);
249
                
250
        Font newfont = null;
251

    
252
        if (dialog.ok) {
253
            newfont = dialog.getCurrentFont();
254
        }
255

    
256
        //dialog.dispose();
257

    
258
        return newfont;
259
    }
260

    
261
    /** This method is called from within the constructor to
262
    * initialize the form.
263
    * WARNING: Do NOT modify this code. The content of this
264
    method is
265
    * always regenerated by the FormEditor.
266
    */
267
    private void jbInit() {
268
        jPanel3 = new javax.swing.JPanel();
269
        jFont = new javax.swing.JTextField();
270
        jScrollPane1 = new javax.swing.JScrollPane();
271
        jFontList = new javax.swing.JList();
272
        jPanel4 = new javax.swing.JPanel();
273
        jStyle = new javax.swing.JTextField();
274
        jScrollPane2 = new javax.swing.JScrollPane();
275
        jStyleList = new javax.swing.JList();
276
        jPanel5 = new javax.swing.JPanel();
277
        jSize = new javax.swing.JTextField();
278
        jScrollPane3 = new javax.swing.JScrollPane();
279
        jSizeList = new javax.swing.JList();
280
        jPanel1 = new javax.swing.JPanel();
281
        jScrollPane4 = new javax.swing.JScrollPane();
282
        jScrollPane4.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
283
        jScrollPane4.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
284
        jSample = new javax.swing.JTextArea();
285
        jSample.setEditable(false);
286
        jButtons = new javax.swing.JPanel();
287
        jOk = new javax.swing.JButton();
288
        jCancel = new javax.swing.JButton();
289
        jLabel6 = new javax.swing.JLabel();
290
        setLayout(new java.awt.GridBagLayout());
291

    
292
        java.awt.GridBagConstraints gridBagConstraints1;
293
        //setTitle("Font Chooser");
294
        /*addWindowListener(new java.awt.event.WindowAdapter() {
295
                public void windowClosing(java.awt.event.WindowEvent evt) {
296
                    closeDialog(evt);
297
                }
298
            });
299
*/
300
        jPanel3.setLayout(new java.awt.GridBagLayout());
301

    
302
        java.awt.GridBagConstraints gridBagConstraints2;
303
        jPanel3.setBorder(new javax.swing.border.TitledBorder(
304
                new javax.swing.border.EtchedBorder(), " "+PluginServices.getText(this,"Font")+" "));
305

    
306
        jFont.setEditable(false);
307
        jFont.setColumns(24);
308
        jFont.addActionListener(new java.awt.event.ActionListener() {
309
                public void actionPerformed(java.awt.event.ActionEvent evt) {
310
                    jFontActionPerformed(evt);
311
                }
312
            });
313
        gridBagConstraints2 = new java.awt.GridBagConstraints();
314
        gridBagConstraints2.gridwidth = 0;
315
        gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
316
        gridBagConstraints2.insets = new java.awt.Insets(0, 3, 0, 3);
317
        gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST;
318
        gridBagConstraints2.weightx = 1.0;
319
        jStyle.setEditable(false);
320
        jPanel3.add(jFont, gridBagConstraints2);
321

    
322
        jFontList.setModel(new DefaultListModel());
323
        jFontList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
324
        jFontList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
325
                public void valueChanged(
326
                    javax.swing.event.ListSelectionEvent evt) {
327
                    jFontListValueChanged(evt);
328
                }
329
            });
330
        jScrollPane1.setViewportView(jFontList);
331

    
332
        gridBagConstraints2 = new java.awt.GridBagConstraints();
333
        gridBagConstraints2.fill = java.awt.GridBagConstraints.BOTH;
334
        gridBagConstraints2.insets = new java.awt.Insets(3, 3, 3, 3);
335
        gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST;
336
        gridBagConstraints2.weightx = 1.0;
337
        gridBagConstraints2.weighty = 1.0;
338
        jPanel3.add(jScrollPane1, gridBagConstraints2);
339

    
340
        gridBagConstraints1 = new java.awt.GridBagConstraints();
341
        gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
342
        gridBagConstraints1.insets = new java.awt.Insets(5, 5, 0, 0);
343
        gridBagConstraints1.weightx = 0.5;
344
        gridBagConstraints1.weighty = 1.0;
345
        add(jPanel3, gridBagConstraints1);
346

    
347
        jPanel4.setLayout(new java.awt.GridBagLayout());
348

    
349
        java.awt.GridBagConstraints gridBagConstraints3;
350
        jPanel4.setBorder(new javax.swing.border.TitledBorder(
351
                new javax.swing.border.EtchedBorder(), " "+PluginServices.getText(this,"Style")+" "));
352

    
353
        jStyle.setColumns(18);
354
        jStyle.addActionListener(new java.awt.event.ActionListener() {
355
                public void actionPerformed(java.awt.event.ActionEvent evt) {
356
                    jStyleActionPerformed(evt);
357
                }
358
            });
359
        gridBagConstraints3 = new java.awt.GridBagConstraints();
360
        gridBagConstraints3.gridwidth = 0;
361
        gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
362
        gridBagConstraints3.insets = new java.awt.Insets(0, 3, 0, 3);
363
        gridBagConstraints3.anchor = java.awt.GridBagConstraints.NORTHWEST;
364
        gridBagConstraints3.weightx = 1.0;
365
        jPanel4.add(jStyle, gridBagConstraints3);
366

    
367
        jStyleList.setModel(new DefaultListModel());
368
        jStyleList.setVisibleRowCount(4);
369
        jStyleList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
370
                public void valueChanged(
371
                    javax.swing.event.ListSelectionEvent evt) {
372
                    jStyleListValueChanged(evt);
373
                }
374
            });
375
        jScrollPane2.setViewportView(jStyleList);
376

    
377
        gridBagConstraints3 = new java.awt.GridBagConstraints();
378
        gridBagConstraints3.fill = java.awt.GridBagConstraints.BOTH;
379
        gridBagConstraints3.insets = new java.awt.Insets(3, 3, 3, 3);
380
        gridBagConstraints3.anchor = java.awt.GridBagConstraints.NORTHWEST;
381
        gridBagConstraints3.weightx = 0.5;
382
        gridBagConstraints3.weighty = 1.0;
383
        jPanel4.add(jScrollPane2, gridBagConstraints3);
384

    
385
        gridBagConstraints1 = new java.awt.GridBagConstraints();
386
        gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
387
        gridBagConstraints1.insets = new java.awt.Insets(5, 5, 0, 0);
388
        gridBagConstraints1.weightx = 0.375;
389
        gridBagConstraints1.weighty = 1.0;
390
        add(jPanel4, gridBagConstraints1);
391

    
392
        jPanel5.setLayout(new java.awt.GridBagLayout());
393

    
394
        java.awt.GridBagConstraints gridBagConstraints4;
395
        jPanel5.setBorder(new javax.swing.border.TitledBorder(
396
                new javax.swing.border.EtchedBorder(), " "+PluginServices.getText(this,"Size")+" "));
397

    
398
        jSize.setColumns(6);
399
        jSize.addActionListener(new java.awt.event.ActionListener() {
400
                public void actionPerformed(java.awt.event.ActionEvent evt) {
401
                    jSizeActionPerformed(evt);
402
                }
403
            });
404
        gridBagConstraints4 = new java.awt.GridBagConstraints();
405
        gridBagConstraints4.gridwidth = 0;
406
        gridBagConstraints4.fill = java.awt.GridBagConstraints.HORIZONTAL;
407
        gridBagConstraints4.insets = new java.awt.Insets(0, 3, 0, 3);
408
        gridBagConstraints4.anchor = java.awt.GridBagConstraints.NORTHWEST;
409
        gridBagConstraints4.weightx = 1.0;
410
        jPanel5.add(jSize, gridBagConstraints4);
411

    
412
        jSizeList.setModel(new DefaultListModel());
413
        jSizeList.setVisibleRowCount(4);
414
        jSizeList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
415
        jSizeList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
416
                public void valueChanged(
417
                    javax.swing.event.ListSelectionEvent evt) {
418
                    jSizeListValueChanged(evt);
419
                }
420
            });
421
        jScrollPane3.setViewportView(jSizeList);
422

    
423
        gridBagConstraints4 = new java.awt.GridBagConstraints();
424
        gridBagConstraints4.fill = java.awt.GridBagConstraints.BOTH;
425
        gridBagConstraints4.insets = new java.awt.Insets(3, 3, 3, 3);
426
        gridBagConstraints4.anchor = java.awt.GridBagConstraints.NORTHWEST;
427
        gridBagConstraints4.weightx = 0.25;
428
        gridBagConstraints4.weighty = 1.0;
429
        jPanel5.add(jScrollPane3, gridBagConstraints4);
430

    
431
        gridBagConstraints1 = new java.awt.GridBagConstraints();
432
        gridBagConstraints1.gridwidth = 0;
433
        gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
434
        gridBagConstraints1.insets = new java.awt.Insets(5, 5, 0, 5);
435
        gridBagConstraints1.weightx = 0.125;
436
        gridBagConstraints1.weighty = 1.0;
437

    
438
        //    getContentPane().add(jPanel5, gridBagConstraints1);
439
        jPanel1.setLayout(new java.awt.GridBagLayout());
440

    
441
        java.awt.GridBagConstraints gridBagConstraints5;
442
        jPanel1.setBorder(new javax.swing.border.TitledBorder(
443
                new javax.swing.border.EtchedBorder(), " "+PluginServices.getText(this,"Sample")+" "));
444

    
445
        jSample.setWrapStyleWord(true);
446
        jSample.setLineWrap(true);
447
        jSample.setColumns(20);
448
        jSample.setRows(3);
449
        jSample.setText(sampleText);
450
        jScrollPane4.setViewportView(jSample);
451

    
452
        gridBagConstraints5 = new java.awt.GridBagConstraints();
453
        gridBagConstraints5.fill = java.awt.GridBagConstraints.BOTH;
454
        gridBagConstraints5.insets = new java.awt.Insets(0, 3, 3, 3);
455
        gridBagConstraints5.weightx = 1.0;
456
        gridBagConstraints5.weighty = 1.0;
457
        jPanel1.add(jScrollPane4, gridBagConstraints5);
458

    
459
        gridBagConstraints1 = new java.awt.GridBagConstraints();
460
        gridBagConstraints1.gridwidth = 0;
461
        gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
462
        gridBagConstraints1.insets = new java.awt.Insets(0, 5, 0, 5);
463
        gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
464
        gridBagConstraints1.weightx = 1.0;
465
        add(jPanel1,
466
            new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0,
467
                GridBagConstraints.CENTER, GridBagConstraints.BOTH,
468
                new Insets(0, 3, 3, 3), 0, 0));
469

    
470
        jButtons.setLayout(new java.awt.GridBagLayout());
471

    
472
        jOk.setMnemonic(KeyEvent.VK_O);
473
        jOk.setText(PluginServices.getText(this,"Aceptar"));
474
        jOk.setRequestFocusEnabled(false);
475
        jOk.addActionListener(new java.awt.event.ActionListener() {
476
                public void actionPerformed(java.awt.event.ActionEvent evt) {
477
                    jOkActionPerformed(evt);
478
                }
479
            });
480
        jButtons.add(jOk,
481
            new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
482
                GridBagConstraints.WEST, GridBagConstraints.NONE,
483
                new Insets(5, 5, 5, 0), 0, 0));
484

    
485
        jCancel.setMnemonic(KeyEvent.VK_C);
486
        jCancel.setText(PluginServices.getText(this,"Cancelar"));
487
        jCancel.setRequestFocusEnabled(false);
488
        jCancel.addActionListener(new java.awt.event.ActionListener() {
489
                public void actionPerformed(java.awt.event.ActionEvent evt) {
490
                    jCancelActionPerformed(evt);
491
                }
492
            });
493

    
494
        jButtons.add(jCancel,
495
            new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
496
                GridBagConstraints.WEST, GridBagConstraints.NONE,
497
                new Insets(5, 5, 5, 5), 0, 0));
498

    
499
        gridBagConstraints1 = new java.awt.GridBagConstraints();
500
        gridBagConstraints1.gridwidth = 0;
501
        gridBagConstraints1.anchor = java.awt.GridBagConstraints.SOUTHWEST;
502
        gridBagConstraints1.weightx = 1.0;
503
        add(jButtons,
504
            new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0,
505
                GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE,
506
                new Insets(0, 0, 0, 0), 0, 0));
507
    }
508

    
509
    private void jCancelActionPerformed(java.awt.event.ActionEvent evt) {
510
        // Add your handling code here:
511
            PluginServices.getMDIManager().closeWindow(FontChooser.this);
512
    }
513

    
514
    private void jOkActionPerformed(java.awt.event.ActionEvent evt) {
515
        // Add your handling code here:
516
        ok = true;
517
        PluginServices.getMDIManager().closeWindow(FontChooser.this);
518
    }
519

    
520
    private void jSizeActionPerformed(java.awt.event.ActionEvent evt) {
521
        // Add your handling code here:
522
        int size = 0;
523

    
524
        try {
525
            size = Integer.parseInt(jSize.getText());
526
        } catch (Exception e) {
527
        }
528

    
529
        if (size > 0) {
530
            currentSize = size;
531
            setSampleFont();
532
        }
533
    }
534

    
535
    private void jStyleActionPerformed(java.awt.event.ActionEvent evt) {
536
        // Add your handling code here:
537
        StringTokenizer st = new StringTokenizer(jStyle.getText(), ",");
538
        int style = 0;
539

    
540
        while (st.hasMoreTokens()) {
541
            String str = st.nextToken().trim();
542

    
543
            if (str.equalsIgnoreCase(PluginServices.getText(this,"Plain"))) {
544
                style |= Font.PLAIN;
545
            } else if (str.equalsIgnoreCase(PluginServices.getText(this,"Bold"))) {
546
                style |= Font.BOLD;
547
            } else if (str.equalsIgnoreCase(PluginServices.getText(this,"Italic"))) {
548
                style |= Font.ITALIC;
549
            }
550
        }
551

    
552
        if (style >= 0) {
553
            currentStyle = style;
554
            setSampleFont();
555
        }
556
    }
557

    
558
    private void jFontActionPerformed(java.awt.event.ActionEvent evt) {
559
        // Add your handling code here:
560
        DefaultListModel model = (DefaultListModel) jFontList.getModel();
561

    
562
        if (model.indexOf(jFont.getText()) >= 0) {
563
            currentFont = jFont.getText();
564
            setSampleFont();
565
        }
566
    }
567

    
568
    private void jStyleListValueChanged(
569
        javax.swing.event.ListSelectionEvent evt) {
570
        // Add your handling code here:
571
        String str = new String();
572
        Object[] values = jStyleList.getSelectedValues();
573

    
574
        if (values.length > 0) {
575
            int j;
576

    
577
            for (j = 0; j < values.length; j++) {
578
                String s = (String) values[j];
579

    
580
                if (s.equalsIgnoreCase(PluginServices.getText(this,"Plain"))) {
581
                    str = PluginServices.getText(this,"Plain");
582

    
583
                    break;
584
                }
585

    
586
                if (str.length() > 0) {
587
                    str += ",";
588
                }
589

    
590
                str += (String) values[j];
591
            }
592
        } else {
593
            str = styleToString(currentStyle);
594
        }
595

    
596
        jStyle.setText(str);
597
        jStyleActionPerformed(null);
598
    }
599

    
600
    private void jSizeListValueChanged(javax.swing.event.ListSelectionEvent evt) {
601
        // Add your handling code here:
602
        String str = (String) jSizeList.getSelectedValue();
603

    
604
        if ((str == null) || (str.length() <= 0)) {
605
            str = Integer.toString(currentSize);
606
        }
607

    
608
        jSize.setText(str);
609
        jSizeActionPerformed(null);
610
    }
611

    
612
    private void jFontListValueChanged(javax.swing.event.ListSelectionEvent evt) {
613
        // Add your handling code here:
614
        String str = (String) jFontList.getSelectedValue();
615

    
616
        if ((str == null) || (str.length() <= 0)) {
617
            str = currentFont;
618
        }
619

    
620
        jFont.setText(str);
621
        jFontActionPerformed(null);
622
    }
623

    
624
   
625

    
626
        /* (non-Javadoc)
627
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
628
         */
629
public WindowInfo getWindowInfo() {
630
        WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
631
                m_viewinfo.setWidth(350);
632
                m_viewinfo.setHeight(250);
633
                //vi.setResizable(false);
634
                m_viewinfo.setTitle(PluginServices.getText(this,"Elegir_Fuente"));
635
        
636
                return m_viewinfo;
637
        }
638

    
639
/**
640
 * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
641
 */
642
public void viewActivated() {
643
}
644

    
645
    // End of variables declaration
646
}