Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_1011 / applications / appgvSIG / src / com / iver / cit / gvsig / gui / utils / FontChooser.java @ 12904

History | View | Annotate | Download (23 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.ui.mdiManager.IWindow;
94
import com.iver.andami.ui.mdiManager.WindowInfo;
95

    
96

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

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

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

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

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

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

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

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

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

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

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

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

    
199
        return str;
200
    }
201

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

    
207
    /* ------------------------------------------------------------- */
208
    public void setCurrentFont(Font font) {
209
        if (font == null) {
210
            font = jSample.getFont();
211
        }
212

    
213
        jFont.setText(font.getName());
214
        jFontActionPerformed(null);
215

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

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

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

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

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

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

    
246
      //  dialog.setLocation(x, y);
247
      //  dialog.setVisible(true);
248

    
249
        Font newfont = null;
250

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

    
255
        //dialog.dispose();
256

    
257
        return newfont;
258
    }
259

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

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

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

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

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

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

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

    
349
        jPanel4.setLayout(new java.awt.GridBagLayout());
350

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

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

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

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

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

    
394
        jPanel5.setLayout(new java.awt.GridBagLayout());
395

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

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

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

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

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

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

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

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

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

    
461
        gridBagConstraints1 = new java.awt.GridBagConstraints();
462
        gridBagConstraints1.gridwidth = 0;
463
        gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
464
        gridBagConstraints1.insets = new java.awt.Insets(0, 5, 0, 5);
465
        gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
466
        gridBagConstraints1.weightx = 1.0;
467
        jButtons.setLayout(new java.awt.GridBagLayout());
468

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

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

    
491
        jButtons.add(jCancel,
492
            new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
493
                GridBagConstraints.WEST, GridBagConstraints.NONE,
494
                new Insets(5, 5, 5, 5), 0, 0));
495

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

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

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

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

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

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

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

    
538
        while (st.hasMoreTokens()) {
539
            String str = st.nextToken().trim();
540

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

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

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

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

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

    
572
        if (values.length > 0) {
573
            int j;
574

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

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

    
581
                    break;
582
                }
583

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

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

    
594
        jStyle.setText(str);
595
        jStyleActionPerformed(null);
596
    }
597

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

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

    
606
        jSize.setText(str);
607
        jSizeActionPerformed(null);
608
    }
609

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

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

    
618
        jFont.setText(str);
619
        jFontActionPerformed(null);
620
    }
621

    
622

    
623

    
624
        /* (non-Javadoc)
625
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
626
         */
627
public WindowInfo getWindowInfo() {
628
        WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
629
                m_viewinfo.setWidth(500);
630
                m_viewinfo.setHeight(300);
631
                //vi.setResizable(false);
632
                m_viewinfo.setTitle(PluginServices.getText(this,"Elegir_Fuente"));
633

    
634
                return m_viewinfo;
635
        }
636

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

    
643
    // End of variables declaration
644
}