01: /*
02: * Copyright (C) 2004 Giuseppe MANNA
03: *
04: * This file is part of FreeReportBuilder
05: *
06: * FreeReportBuilder is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License
08: * as published by the Free Software Foundation; either version 2
09: * of the License, or (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: *
20: */
21: package it.frb;
22:
23: import java.awt.*;
24: import javax.swing.border.*;
25: import javax.swing.*;
26:
27: public final class JSplash extends JWindow {
28: private JLabel lblVersion = new JLabel();
29:
30: public JSplash() {
31: init();
32: center();
33: }
34:
35: private void init() {
36: JPanel pnlImage = new JPanel();
37: ImageIcon image = new ImageIcon(getClass().getResource(
38: "img/logo.jpg"));
39: JLabel lblBack = new JLabel(image);
40: Border raisedbevel = BorderFactory.createRaisedBevelBorder();
41: Border loweredbevel = BorderFactory.createLoweredBevelBorder();
42:
43: lblBack.setBounds(0, 0, image.getIconWidth(), image
44: .getIconHeight());
45: getLayeredPane().add(lblBack, new Integer(Integer.MIN_VALUE));
46:
47: pnlImage.setLayout(null);
48: pnlImage.setOpaque(false);
49: pnlImage.setBorder(BorderFactory.createCompoundBorder(
50: raisedbevel, loweredbevel));
51:
52: pnlImage.add(this .lblVersion);
53:
54: this .lblVersion.setForeground(Color.white);
55: this .lblVersion.setFont(new Font("Dialog", Font.PLAIN, 12));
56: this .lblVersion.setBounds(15, 69, 120, 20);
57:
58: setContentPane(pnlImage);
59: setSize(image.getIconWidth(), image.getIconHeight());
60: }
61:
62: private void center() {
63: Dimension scr = Toolkit.getDefaultToolkit().getScreenSize();
64: int nX = (int) (scr.getWidth() - getWidth()) / 2;
65: int nY = (int) (scr.getHeight() - getHeight()) / 2;
66:
67: setLocation(nX, nY);
68: }
69: }
|