001: /**
002: * $RCSfile: VAWelcomePanel.java,v $
003: * @creation 01/02/00
004: * @modification $Date: 2005/03/30 19:42:11 $
005: */package com.memoire.vainstall.gui;
006:
007: import java.io.*;
008: import java.awt.*;
009: import java.awt.event.*;
010: import javax.swing.*;
011: import javax.swing.border.*;
012: import com.memoire.vainstall.VAGlobals;
013: import com.memoire.vainstall.VAWelcomeStep;
014:
015: /**
016: * @version $Id: VAWelcomePanel.java,v 1.7 2005/03/30 19:42:11 deniger Exp $
017: * @author Axel von Arnim
018: */
019:
020: public class VAWelcomePanel extends VAPanel implements ActionListener,
021: VAWelcomeStep {
022: Icon vaiLogo_;
023:
024: public VAWelcomePanel() {
025: super ();
026:
027: setLayout(new BoxLayout(this , BoxLayout.X_AXIS));
028:
029: JPanel pnMain = new JPanel();
030: pnMain.setBorder(new CompoundBorder(new EtchedBorder(),
031: new EmptyBorder(new Insets(5, 5, 5, 5))));
032: pnMain.setLayout(new GridLayout(2, 1));
033:
034: JPanel pnHaut = new JPanel();
035: pnHaut.setLayout(new BorderLayout());
036:
037: JPanel pnTitle = new JPanel();
038: pnTitle.setOpaque(true);
039: pnTitle.setBackground(pnMain.getBackground().brighter());
040: pnTitle.setLayout(new BorderLayout());
041: pnTitle.setBorder(new EmptyBorder(new Insets(10, 2, 10, 2)));
042:
043: JLabel lbTitle;
044: if (VAGlobals.APP_VERSION != null)
045: lbTitle = new JLabel(VAGlobals.APP_NAME + " "
046: + VAGlobals.APP_VERSION);
047: else
048: lbTitle = new JLabel(VAGlobals.APP_NAME + " (no version)");
049: lbTitle.setHorizontalAlignment(JLabel.CENTER);
050: lbTitle.setForeground(Color.red);
051: Font f = lbTitle.getFont().deriveFont(Font.BOLD, (float) 20.);
052: lbTitle.setFont(f);
053: lbTitle.setOpaque(false);
054: pnTitle.add(BorderLayout.NORTH, lbTitle);
055:
056: JLabel lbTitle2 = new JLabel(
057: VAGlobals.OPERATION == VAGlobals.INSTALL ? VAGlobals
058: .i18n("UI_Installation")
059: : VAGlobals.OPERATION == VAGlobals.UPDATE ? VAGlobals
060: .i18n("UI_Update")
061: : VAGlobals.OPERATION == VAGlobals.UNINSTALL ? VAGlobals
062: .i18n("UI_Uninstallation")
063: : VAGlobals
064: .i18n("UI_UnknownOperation"));
065: lbTitle2.setHorizontalAlignment(JLabel.CENTER);
066: lbTitle2.setForeground(Color.red);
067: f = lbTitle2.getFont().deriveFont(Font.BOLD);
068: lbTitle2.setFont(f);
069: lbTitle2.setOpaque(false);
070: pnTitle.add(BorderLayout.SOUTH, lbTitle2);
071:
072: JPanel pnAbout = new JPanel();
073: pnAbout.setLayout(new BorderLayout());
074: InputStream imgStream = VAGlobals.BASE_CLASS
075: .getResourceAsStream("resources/vailogo.gif");
076:
077: JButton btAbout;
078: if (imgStream != null) {
079: ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
080: try {
081: byte[] buf = new byte[1024];
082: int read = imgStream.read(buf, 0, buf.length);
083: while (read > 0) {
084: dataStream.write(buf, 0, read);
085: read = imgStream.read(buf, 0, buf.length);
086: }
087: imgStream.close();
088: vaiLogo_ = new ImageIcon(dataStream.toByteArray());
089: dataStream.close();
090: } catch (IOException ex) {
091: }
092: }
093: if (vaiLogo_ == null)
094: btAbout = new JButton(VAGlobals
095: .i18n("VAWelcomePanel_About")
096: + " " + VAGlobals.NAME);
097: else
098: btAbout = new JButton(vaiLogo_);
099: btAbout.addActionListener(this );
100: pnAbout.add(BorderLayout.SOUTH, btAbout);
101:
102: pnHaut.add(BorderLayout.NORTH, pnTitle);
103: pnHaut.add(BorderLayout.SOUTH, new JLabel(VAGlobals
104: .i18n("UI_ClickNextToStart")));
105: pnMain.add(pnHaut);
106: pnMain.add(pnAbout);
107:
108: JComponent pnImage = VAImagePanel.IMAGE_PANEL;
109: add(pnImage);
110: add(pnMain);
111: }
112:
113: public void actionPerformed(ActionEvent e) {
114: JOptionPane.showMessageDialog(null, VAGlobals.NAME + " "
115: + VAGlobals.VERSION + "\n" + VAGlobals.AUTHOR + " <"
116: + VAGlobals.EMAIL + ">" + "\n" + VAGlobals.HTTP + "\n"
117: + VAGlobals.i18n("VAWelcomePanel_License")
118: + VAGlobals.LICENSE + "\n"
119: + VAGlobals.i18n("VAWelcomePanel_Copyright")
120: + VAGlobals.COPYRIGHT, VAGlobals
121: .i18n("VAWelcomePanel_About"),
122: JOptionPane.INFORMATION_MESSAGE, vaiLogo_);
123: }
124: }
|