001: /**
002: * $RCSfile: XuiBlueScreen.java,v $
003: * @creation 01/02/00
004: * @modification $Date: 2005/03/30 19:43:00 $
005: */package com.memoire.vainstall.xui;
006:
007: import java.awt.*;
008: import java.awt.event.*;
009: import javax.swing.*;
010: import javax.swing.border.*;
011: import com.memoire.vainstall.*;
012:
013: /**
014: * @version $Id: XuiBlueScreen.java,v 1.5 2005/03/30 19:43:00 deniger Exp $
015: * @author Guillaume Desnoix
016: */
017:
018: public class XuiBlueScreen extends JWindow {
019: public final static Frame MAIN = new Frame();
020:
021: public XuiBlueScreen() {
022: super (MAIN);
023:
024: if (VAGlobals.UI_BLUESCREEN_COLOR == null)
025: VAGlobals.UI_BLUESCREEN_COLOR = new Color(0, 192, 232);
026:
027: XuiPanel cp = new XuiPanel();
028: cp.setBackground(VAGlobals.UI_BLUESCREEN_COLOR);
029: cp.setLayout(new BorderLayout());
030: cp.setBorder(new LineBorder(Color.black, 10));
031:
032: XuiTitle power = new XuiTitle(VAGlobals.NAME + " "
033: + VAGlobals.VERSION + VAGlobals.i18n("UI_Powered"),
034: XuiTitle.LEFT);
035:
036: power.setFont(new Font("SansSerif", Font.ITALIC, 16));
037:
038: XuiTitle prog;
039: if (VAGlobals.APP_VERSION != null)
040: prog = new XuiTitle(VAGlobals.APP_NAME + " "
041: + VAGlobals.APP_VERSION);
042: else
043: prog = new XuiTitle(VAGlobals.APP_NAME + " (no version)");
044: // prog.setForeground(VAGlobals.UI_BLUESCREEN_COLOR);
045:
046: cp.add(prog, BorderLayout.NORTH);
047: cp.add(power, BorderLayout.SOUTH);
048:
049: setContentPane(cp);
050:
051: Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
052: // setBounds(60, 60, screen.width-120, screen.height-120);
053: setBounds(-1, -1, screen.width + 2, screen.height + 2);
054: }
055:
056: public void paint(Graphics _g) {
057: toBack();
058: super .paint(_g);
059: }
060:
061: /*
062: public XuiBlueScreen()
063: {
064: super(MAIN);
065:
066: // Escape listener
067: addKeyListener(new KeyAdapter() {
068: public void keyPressed(KeyEvent e)
069: {
070: if( e.getKeyCode()==KeyEvent.VK_ESCAPE ) {
071: dispose();
072: VAGlobals.printDebug("Blue screen killed");
073: }
074: }
075: });
076:
077: if( VAGlobals.UI_BLUESCREEN_COLOR==null ) {
078: VAGlobals.UI_BLUESCREEN_COLOR=new Color(0,192,232);
079: }
080:
081: getContentPane().setBackground(VAGlobals.UI_BLUESCREEN_COLOR);
082: ((JPanel)getContentPane()).setBorder(new LineBorder(Color.black,10));
083:
084: Dimension screen=Toolkit.getDefaultToolkit().getScreenSize();
085: setBounds(60, 60, screen.width-120, screen.height-120);
086: }
087:
088: public void paint(Graphics _g)
089: {
090: // degrade
091: Color bg=getContentPane().getBackground();
092: int rapport=10;
093: int taille=5;
094: Color curbg=new Color(bg.getRed()/rapport,
095: bg.getGreen()/rapport,
096: bg.getBlue()/rapport);
097: int y=0;
098: Dimension size=getSize();
099: int n=size.height/taille;
100: int maxc=curbg.getRed();
101: if( curbg.getGreen()>maxc ) maxc=curbg.getGreen();
102: if( curbg.getBlue()>maxc ) maxc=curbg.getBlue();
103: double coef=Math.pow(255./maxc, 1./(n+1));
104: double r=curbg.getRed();
105: double g=curbg.getGreen();
106: double b=curbg.getBlue();
107: while( y<size.height ) {
108: _g.setColor(curbg);
109: _g.fillRect(0, y, size.width, taille);
110: y+=taille;
111: r*=coef; g*=coef; b*=coef;
112: curbg=new Color((int)r, (int)g, (int)b);
113: }
114:
115: // deco texte
116: Font font=new Font("SansSerif", Font.BOLD, 24);
117: _g.setColor(Color.white);
118: _g.setFont(font);
119: FontMetrics metrics=_g.getFontMetrics();
120: _g.drawString(VAGlobals.APP_NAME+" "+VAGlobals.APP_VERSION, 10, metrics.getHeight()+10);
121:
122: _g.setFont(new Font("SansSerif", Font.PLAIN, 12));
123: _g.drawString("VAInstall "+VAGlobals.VERSION+" powered", 10, size.height-10);
124: }
125: */
126: }
|