home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 February / PCpro_2005_02.ISO / files / opensource / Opcion_1.1.1 / Opcion_v1.1.1.exe / FontViewer / windows / Splash.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-04-25  |  3.8 KB  |  76 lines

  1. package FontViewer.windows;
  2.  
  3. import FontViewer.components.TextAreaFromFile;
  4. import java.awt.BorderLayout;
  5. import java.awt.Color;
  6. import java.awt.Dimension;
  7. import java.awt.GridLayout;
  8. import java.awt.Toolkit;
  9. import java.awt.event.WindowEvent;
  10. import java.util.ResourceBundle;
  11. import javax.swing.ImageIcon;
  12. import javax.swing.JLabel;
  13. import javax.swing.JPanel;
  14. import javax.swing.JTextArea;
  15. import javax.swing.JWindow;
  16. import javax.swing.border.LineBorder;
  17.  
  18. public class Splash extends JWindow {
  19.    private ImageIcon splashImage;
  20.    private JLabel jLabel1;
  21.    private JLabel jLabel2;
  22.    private JPanel jPanel1;
  23.    private JPanel jPanel2;
  24.    private JTextArea jTextArea1;
  25.  
  26.    public Splash(String iconName) {
  27.       ClassLoader cl = this.getClass().getClassLoader();
  28.       this.splashImage = new ImageIcon(cl.getResource("FontViewer/resources/icons/" + iconName));
  29.       this.initComponents();
  30.       int w = 400;
  31.       int h = 150;
  32.       Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  33.       this.setBounds((screenSize.width - w) / 2, (screenSize.height - h) / 2, w, h);
  34.    }
  35.  
  36.    private void initComponents() {
  37.       this.jPanel2 = new JPanel();
  38.       this.jPanel1 = new JPanel();
  39.       this.jLabel1 = new JLabel();
  40.       this.jLabel2 = new JLabel();
  41.       this.jTextArea1 = new TextAreaFromFile("notice.txt");
  42.       this.setBackground(Color.white);
  43.       this.addWindowListener(new 1(this));
  44.       this.jPanel2.setLayout(new GridLayout(1, 2, 0, 1));
  45.       this.jPanel2.setBackground(new Color(102, 102, 102));
  46.       this.jPanel2.setBorder(new LineBorder(new Color(102, 102, 102), 1, true));
  47.       this.jPanel1.setLayout(new BorderLayout());
  48.       this.jLabel1.setBackground(new Color(255, 255, 255));
  49.       this.jLabel1.setHorizontalAlignment(0);
  50.       this.jLabel1.setIcon(this.splashImage);
  51.       this.jLabel1.setOpaque(true);
  52.       this.jPanel1.add(this.jLabel1, "Center");
  53.       this.jLabel2.setBackground(new Color(0, 0, 0));
  54.       this.jLabel2.setForeground(new Color(255, 255, 255));
  55.       this.jLabel2.setHorizontalAlignment(0);
  56.       this.jLabel2.setText("Version " + ResourceBundle.getBundle("FontViewer.resources.Opcion").getString("version"));
  57.       this.jLabel2.setOpaque(true);
  58.       this.jPanel1.add(this.jLabel2, "South");
  59.       this.jPanel2.add(this.jPanel1);
  60.       this.jTextArea1.setBackground(new Color(204, 255, 204));
  61.       this.jTextArea1.setForeground(new Color(102, 102, 102));
  62.       this.jPanel2.add(this.jTextArea1);
  63.       this.getContentPane().add(this.jPanel2, "Center");
  64.       this.pack();
  65.    }
  66.  
  67.    private void exitForm(WindowEvent evt) {
  68.       System.exit(0);
  69.    }
  70.  
  71.    // $FF: synthetic method
  72.    static void access$000(Splash x0, WindowEvent x1) {
  73.       x0.exitForm(x1);
  74.    }
  75. }
  76.