01: /**
02: * $RCSfile: VABlueScreen.java,v $
03: * @creation 01/02/00
04: * @modification $Date: 2005/03/30 19:42:12 $
05: */package com.memoire.vainstall.gui;
06:
07: import java.awt.*;
08: import java.awt.event.*;
09: import javax.swing.*;
10: import com.memoire.vainstall.*;
11:
12: /**
13: * @version $Id: VABlueScreen.java,v 1.4 2005/03/30 19:42:12 deniger Exp $
14: * @author Axel von Arnim
15: */
16:
17: public class VABlueScreen extends JWindow {
18: public VABlueScreen() {
19: super ();
20: // Escape listener
21: addKeyListener(new KeyAdapter() {
22: public void keyPressed(KeyEvent e) {
23: if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
24: dispose();
25: VAGlobals.printDebug("Blue screen killed");
26: }
27: }
28: });
29:
30: if (VAGlobals.UI_BLUESCREEN_COLOR == null) {
31: VAGlobals.UI_BLUESCREEN_COLOR = Color.blue;
32: }
33: getContentPane().setBackground(VAGlobals.UI_BLUESCREEN_COLOR);
34: Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
35: setBounds(0, 0, screen.width, screen.height);
36: }
37:
38: public void paint(Graphics _g) {
39: // degrade
40: Color bg = getContentPane().getBackground();
41: int rapport = 10;
42: int taille = 5;
43: Color curbg = new Color(bg.getRed() / rapport, bg.getGreen()
44: / rapport, bg.getBlue() / rapport);
45: int y = 0;
46: Dimension size = getSize();
47: int n = size.height / taille;
48: int maxc = curbg.getRed();
49: if (curbg.getGreen() > maxc)
50: maxc = curbg.getGreen();
51: if (curbg.getBlue() > maxc)
52: maxc = curbg.getBlue();
53: double coef = Math.pow(255. / maxc, 1. / (n + 1));
54: double r = curbg.getRed();
55: double g = curbg.getGreen();
56: double b = curbg.getBlue();
57: while (y < size.height) {
58: _g.setColor(curbg);
59: _g.fillRect(0, y, size.width, taille);
60: y += taille;
61: r *= coef;
62: g *= coef;
63: b *= coef;
64: curbg = new Color((int) r, (int) g, (int) b);
65: }
66:
67: // deco texte
68: Font font = new Font("Serif", Font.BOLD | Font.ITALIC, 28);
69: _g.setColor(Color.white);
70: _g.setFont(font);
71: FontMetrics metrics = _g.getFontMetrics();
72: if (VAGlobals.APP_VERSION != null)
73: _g.drawString(VAGlobals.APP_NAME + " "
74: + VAGlobals.APP_VERSION, 10,
75: metrics.getHeight() + 10);
76: else
77: _g.drawString(VAGlobals.APP_NAME + " (no version)", 10,
78: metrics.getHeight() + 10);
79: _g.setFont(font.deriveFont(22));
80: _g.drawString(VAGlobals.NAME + " " + VAGlobals.VERSION
81: + VAGlobals.i18n("UI_Powered"), 10, size.height - 10);
82: }
83: }
|