KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > memoire > vainstall > xui > XuiBlueScreen


1 /**
2  * $RCSfile: XuiBlueScreen.java,v $
3  * @creation 01/02/00
4  * @modification $Date: 2005/03/30 19:43:00 $
5  */

6
7 package com.memoire.vainstall.xui;
8
9 import java.awt.*;
10 import java.awt.event.*;
11 import javax.swing.*;
12 import javax.swing.border.*;
13 import com.memoire.vainstall.*;
14
15 /**
16  * @version $Id: XuiBlueScreen.java,v 1.5 2005/03/30 19:43:00 deniger Exp $
17  * @author Guillaume Desnoix
18  */

19
20 public class XuiBlueScreen
21        extends JWindow
22 {
23   public final static Frame MAIN=new Frame();
24
25   public XuiBlueScreen()
26   {
27     super(MAIN);
28
29     if(VAGlobals.UI_BLUESCREEN_COLOR==null)
30       VAGlobals.UI_BLUESCREEN_COLOR=new Color(0,192,232);
31
32     XuiPanel cp=new XuiPanel();
33     cp.setBackground(VAGlobals.UI_BLUESCREEN_COLOR);
34     cp.setLayout(new BorderLayout());
35     cp.setBorder(new LineBorder(Color.black,10));
36
37     XuiTitle power=new XuiTitle(VAGlobals.NAME
38                                 +" "
39                                 +VAGlobals.VERSION
40                                 +VAGlobals.i18n("UI_Powered"),XuiTitle.LEFT);
41
42     power.setFont(new Font("SansSerif",Font.ITALIC,16));
43
44     XuiTitle prog;
45     if (VAGlobals.APP_VERSION != null)
46         prog=new XuiTitle(VAGlobals.APP_NAME+" "+VAGlobals.APP_VERSION);
47     else
48         prog=new XuiTitle(VAGlobals.APP_NAME+" (no version)");
49     // prog.setForeground(VAGlobals.UI_BLUESCREEN_COLOR);
50

51     cp.add(prog ,BorderLayout.NORTH);
52     cp.add(power,BorderLayout.SOUTH);
53
54     setContentPane(cp);
55
56     Dimension screen=Toolkit.getDefaultToolkit().getScreenSize();
57     // setBounds(60, 60, screen.width-120, screen.height-120);
58
setBounds(-1,-1,screen.width+2,screen.height+2);
59   }
60
61   public void paint(Graphics _g)
62   {
63     toBack();
64     super.paint(_g);
65   }
66
67   /*
68   public XuiBlueScreen()
69   {
70     super(MAIN);
71
72     // Escape listener
73     addKeyListener(new KeyAdapter() {
74       public void keyPressed(KeyEvent e)
75       {
76         if( e.getKeyCode()==KeyEvent.VK_ESCAPE ) {
77           dispose();
78           VAGlobals.printDebug("Blue screen killed");
79         }
80       }
81     });
82
83     if( VAGlobals.UI_BLUESCREEN_COLOR==null ) {
84       VAGlobals.UI_BLUESCREEN_COLOR=new Color(0,192,232);
85     }
86
87     getContentPane().setBackground(VAGlobals.UI_BLUESCREEN_COLOR);
88     ((JPanel)getContentPane()).setBorder(new LineBorder(Color.black,10));
89
90     Dimension screen=Toolkit.getDefaultToolkit().getScreenSize();
91     setBounds(60, 60, screen.width-120, screen.height-120);
92   }
93   
94   public void paint(Graphics _g)
95   {
96     // degrade
97     Color bg=getContentPane().getBackground();
98     int rapport=10;
99     int taille=5;
100     Color curbg=new Color(bg.getRed()/rapport,
101                           bg.getGreen()/rapport,
102                           bg.getBlue()/rapport);
103     int y=0;
104     Dimension size=getSize();
105     int n=size.height/taille;
106     int maxc=curbg.getRed();
107     if( curbg.getGreen()>maxc ) maxc=curbg.getGreen();
108     if( curbg.getBlue()>maxc ) maxc=curbg.getBlue();
109     double coef=Math.pow(255./maxc, 1./(n+1));
110     double r=curbg.getRed();
111     double g=curbg.getGreen();
112     double b=curbg.getBlue();
113     while( y<size.height ) {
114       _g.setColor(curbg);
115       _g.fillRect(0, y, size.width, taille);
116       y+=taille;
117       r*=coef; g*=coef; b*=coef;
118       curbg=new Color((int)r, (int)g, (int)b);
119     }
120
121     // deco texte
122     Font font=new Font("SansSerif", Font.BOLD, 24);
123     _g.setColor(Color.white);
124     _g.setFont(font);
125     FontMetrics metrics=_g.getFontMetrics();
126     _g.drawString(VAGlobals.APP_NAME+" "+VAGlobals.APP_VERSION, 10, metrics.getHeight()+10);
127
128     _g.setFont(new Font("SansSerif", Font.PLAIN, 12));
129     _g.drawString("VAInstall "+VAGlobals.VERSION+" powered", 10, size.height-10);
130   }
131   */

132 }
133
Popular Tags