01: /*
02: ** $Id: ViennaSplash.java,v 1.3 2000/11/01 16:07:48 mrw Exp $
03: **
04: ** Mike Wilson, July 2000, mrw@whisperingwind.co.uk
05: **
06: ** (C) Copyright 2000, Mike Wilson, Reading, Berkshire, UK
07: **
08: ** This program is free software; you can redistribute it and/or modify
09: ** it under the terms of the GNU General Public License as published by
10: ** the Free Software Foundation; either version 2 of the License, or
11: ** (at your option) any later version.
12: **
13: ** This program is distributed in the hope that it will be useful,
14: ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15: ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: ** GNU General Public License for more details.
17: **
18: ** You should have received a copy of the GNU Library General
19: ** Public License along with this library; if not, write to the
20: ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21: ** Boston, MA 02111-1307 USA.
22: */
23:
24: package uk.co.whisperingwind.vienna;
25:
26: import java.awt.BorderLayout;
27: import java.awt.Color;
28: import java.awt.Dimension;
29: import java.awt.MediaTracker;
30: import java.awt.Toolkit;
31: import javax.swing.BorderFactory;
32: import javax.swing.ImageIcon;
33: import javax.swing.JLabel;
34: import javax.swing.JPanel;
35: import javax.swing.JWindow;
36:
37: /**
38: ** ViennaSQL splash screen. Displayed while the main window is
39: ** loading.
40: */
41:
42: class ViennaSplash extends JWindow {
43: public ViennaSplash() {
44: getContentPane().add(new SplashPanel(), BorderLayout.CENTER);
45: pack();
46:
47: Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
48: int height = getHeight();
49: int width = getWidth();
50:
51: setLocation((screen.width - width) / 2,
52: (screen.height - height) / 2);
53: setVisible(true);
54: }
55:
56: private class SplashPanel extends JPanel {
57: public SplashPanel() {
58: this .setBorder(BorderFactory.createLineBorder(Color.black));
59: this .setLayout(new BorderLayout());
60:
61: String filePath = "/uk/co/whisperingwind/images/viennalogo.gif";
62: ImageIcon i = new ImageIcon(this .getClass().getResource(
63: filePath));
64: JLabel label = new JLabel(i);
65: this .add(label, BorderLayout.CENTER);
66:
67: MediaTracker tracker = new MediaTracker(label);
68: tracker.addImage(i.getImage(), 0);
69:
70: try {
71: tracker.waitForAll();
72: } catch (InterruptedException ex) {
73: // Do nothing
74: }
75: }
76: }
77: }
|