KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > businesslogic > ireport > gui > fonts > FontLoaderDialog


1 /*
2  * FontLoaderDialog.java
3  *
4  * Created on November 13, 2006, 8:30 AM
5  */

6
7 package it.businesslogic.ireport.gui.fonts;
8
9 import it.businesslogic.ireport.FontsLoaderMonitor;
10 import java.lang.reflect.InvocationTargetException JavaDoc;
11 import javax.swing.SwingUtilities JavaDoc;
12 import it.businesslogic.ireport.util.I18n;
13
14 /**
15  *
16  * @author gtoffoli
17  */

18 public class FontLoaderDialog extends javax.swing.JDialog JavaDoc implements FontsLoaderMonitor {
19     
20     /** Creates new form FontLoaderDialog */
21     public FontLoaderDialog(java.awt.Frame JavaDoc parent, boolean modal) {
22         super(parent, modal);
23         initComponents();
24         applyI18n();
25         this.pack();
26         
27         it.businesslogic.ireport.util.Misc.centerFrame( this );
28     }
29     
30     /** This method is called from within the constructor to
31      * initialize the form.
32      * WARNING: Do NOT modify this code. The content of this method is
33      * always regenerated by the Form Editor.
34      */

35     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
36
private void initComponents() {
37         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
38
39         jLabelStatus = new javax.swing.JLabel JavaDoc();
40
41         getContentPane().setLayout(new java.awt.GridBagLayout JavaDoc());
42
43         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
44         jLabelStatus.setText("Loading status");
45         jLabelStatus.setVerticalAlignment(javax.swing.SwingConstants.TOP);
46         jLabelStatus.setPreferredSize(new java.awt.Dimension JavaDoc(391, 51));
47         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
48         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
49         gridBagConstraints.weightx = 1.0;
50         gridBagConstraints.weighty = 1.0;
51         gridBagConstraints.insets = new java.awt.Insets JavaDoc(4, 4, 4, 4);
52         getContentPane().add(jLabelStatus, gridBagConstraints);
53
54         pack();
55     }// </editor-fold>//GEN-END:initComponents
56

57     /**
58      * @param args the command line arguments
59      */

60     public static void main(String JavaDoc args[]) {
61         java.awt.EventQueue.invokeLater(new Runnable JavaDoc() {
62             public void run() {
63                 new FontLoaderDialog(new javax.swing.JFrame JavaDoc(), true).setVisible(true);
64             }
65         });
66     }
67
68     public void setStatus(String JavaDoc s)
69     {
70         jLabelStatus.setText(s);
71     }
72     
73     public void fontsLoadingStatusUpdated(String JavaDoc statusMsg) {
74         
75         final String JavaDoc s = statusMsg;
76         try {
77             SwingUtilities.invokeAndWait( new Runnable JavaDoc()
78             {
79                 public void run()
80                 {
81                     setStatus(s);
82                 }
83             }
84             );
85         } catch (InterruptedException JavaDoc ex) {
86             ex.printStackTrace();
87         } catch (InvocationTargetException JavaDoc ex) {
88             ex.printStackTrace();
89         }
90         
91     }
92
93     public void fontsLoadingStarted() {
94         
95         try {
96             SwingUtilities.invokeAndWait( new Runnable JavaDoc()
97             {
98                 public void run()
99                 {
100                     setVisible(true);
101                 }
102             }
103             );
104         } catch (InterruptedException JavaDoc ex) {
105             ex.printStackTrace();
106         } catch (InvocationTargetException JavaDoc ex) {
107             ex.printStackTrace();
108         }
109     }
110
111     public void fontsLoadingFinished() {
112         try {
113             SwingUtilities.invokeAndWait( new Runnable JavaDoc()
114             {
115                 public void run()
116                 {
117                     setVisible(false);
118                 }
119             }
120             );
121         } catch (InterruptedException JavaDoc ex) {
122             ex.printStackTrace();
123         } catch (InvocationTargetException JavaDoc ex) {
124             ex.printStackTrace();
125         }
126     }
127     
128     // Variables declaration - do not modify//GEN-BEGIN:variables
129
private javax.swing.JLabel JavaDoc jLabelStatus;
130     // End of variables declaration//GEN-END:variables
131

132     public void applyI18n(){
133                 // Start autogenerated code ----------------------
134
jLabelStatus.setText(I18n.getString("fontLoaderDialog.labelStatus","Loading status"));
135                 // End autogenerated code ----------------------
136
}
137 }
138
Popular Tags