1 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 72 private void initComponents() { 73 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 Container contentPane = backgroundPanel; 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 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 appNameLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 48)); 115 appNameLabel.setText("ANTLRWorks"); 116 contentPane.add(appNameLabel, cc.xy(5, 3)); 117 118 infoLabel.setText("Edit, visualize and debug ANTLR grammars"); 120 infoLabel.setVerticalAlignment(SwingConstants.TOP); 121 contentPane.add(infoLabel, cc.xy(5, 5)); 122 123 versionLabel.setText("Version 1.0er1"); 125 contentPane.add(versionLabel, cc.xy(5, 7)); 126 127 copyrightLabel.setText("(c) 2005 Jean Bovet & Terence Parr"); 129 contentPane.add(copyrightLabel, cc.xy(5, 9)); 130 } 132 133 private JButton iconButton; 135 private JLabel appNameLabel; 136 private JLabel infoLabel; 137 private JLabel versionLabel; 138 private JLabel copyrightLabel; 139 } 141 | Popular Tags |