KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > antlr > works > SplashScreen


1 /*
2
3 [The "BSD licence"]
4 Copyright (c) 2005 Jean Bovet
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
9 are met:
10
11 1. Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer.
13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
16 3. The name of the author may not be used to endorse or promote products
17 derived from this software without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 */

31
32 package org.antlr.works;
33
34 import com.jgoodies.forms.factories.FormFactory;
35 import com.jgoodies.forms.layout.*;
36 import org.antlr.xjlib.foundation.XJSystem;
37 import org.antlr.works.utils.IconManager;
38 import org.antlr.works.utils.Localizable;
39
40 import javax.swing.*;
41 import java.awt.*;
42
43 public class SplashScreen extends JWindow {
44
45     protected JPanel backgroundPanel;
46
47     public SplashScreen() {
48         backgroundPanel = new JPanel();
49
50         initComponents();
51
52         iconButton.setIcon(IconManager.shared().getIconApplication());
53         iconButton.setContentAreaFilled(false);
54
55         appNameLabel.setText(Localizable.getLocalizedString(Localizable.APP_NAME));
56         infoLabel.setText(Localizable.getLocalizedString(Localizable.SPLASH_INFO));
57         versionLabel.setText(Localizable.getLocalizedString(Localizable.SPLASH_VERSION));
58         copyrightLabel.setText(Localizable.getLocalizedString(Localizable.SPLASH_COPYRIGHT));
59
60         backgroundPanel.setBorder(BorderFactory.createLineBorder(Color.black));
61         if(!XJSystem.isMacOS())
62             backgroundPanel.setBackground(Color.white);
63         getContentPane().add(backgroundPanel);
64
65         pack();
66         setLocationRelativeTo(null);
67     }
68
69     // !!!!! Replace getContentPane() with backgroundPanel after re-generation
70
// with JFormDesigner !!!!
71

72     private void initComponents() {
73         // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
74
iconButton = new JButton();
75         appNameLabel = new JLabel();
76         infoLabel = new JLabel();
77         versionLabel = new JLabel();
78         copyrightLabel = new JLabel();
79         CellConstraints cc = new CellConstraints();
80
81         //======== this ========
82
Container contentPane = backgroundPanel; //getContentPane();
83
contentPane.setLayout(new FormLayout(
84             new ColumnSpec[] {
85                 new ColumnSpec(Sizes.dluX(0)),
86                 FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
87                 FormFactory.DEFAULT_COLSPEC,
88                 new ColumnSpec(ColumnSpec.LEFT, Sizes.DLUX5, FormSpec.NO_GROW),
89                 FormFactory.DEFAULT_COLSPEC,
90                 FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
91                 new ColumnSpec(Sizes.dluX(10))
92             },
93             new RowSpec[] {
94                 new RowSpec(Sizes.dluY(10)),
95                 FormFactory.LINE_GAP_ROWSPEC,
96                 new RowSpec(RowSpec.TOP, Sizes.DEFAULT, FormSpec.NO_GROW),
97                 FormFactory.LINE_GAP_ROWSPEC,
98                 new RowSpec(RowSpec.TOP, Sizes.dluY(10), FormSpec.NO_GROW),
99                 FormFactory.LINE_GAP_ROWSPEC,
100                 FormFactory.DEFAULT_ROWSPEC,
101                 FormFactory.LINE_GAP_ROWSPEC,
102                 FormFactory.DEFAULT_ROWSPEC,
103                 FormFactory.LINE_GAP_ROWSPEC,
104                 new RowSpec(Sizes.dluY(10))
105             }));
106
107         //---- button1 ----
108
iconButton.setBorder(null);
109         iconButton.setBorderPainted(false);
110         iconButton.setIcon(IconManager.shared().getIconApplication());
111         contentPane.add(iconButton, cc.xywh(3, 3, 1, 7));
112
113         //---- label1 ----
114
appNameLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 48));
115         appNameLabel.setText("ANTLRWorks");
116         contentPane.add(appNameLabel, cc.xy(5, 3));
117
118         //---- label3 ----
119
infoLabel.setText("Edit, visualize and debug ANTLR grammars");
120         infoLabel.setVerticalAlignment(SwingConstants.TOP);
121         contentPane.add(infoLabel, cc.xy(5, 5));
122
123         //---- label4 ----
124
versionLabel.setText("Version 1.0er1");
125         contentPane.add(versionLabel, cc.xy(5, 7));
126
127         //---- label2 ----
128
copyrightLabel.setText("(c) 2005 Jean Bovet & Terence Parr");
129         contentPane.add(copyrightLabel, cc.xy(5, 9));
130         // JFormDesigner - End of component initialization //GEN-END:initComponents
131
}
132
133     // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
134
private JButton iconButton;
135     private JLabel appNameLabel;
136     private JLabel infoLabel;
137     private JLabel versionLabel;
138     private JLabel copyrightLabel;
139     // JFormDesigner - End of variables declaration //GEN-END:variables
140
}
141
Popular Tags