01: // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
02: // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
03: // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
04: // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
05: // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
06: // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
07: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
08: // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
09: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
10: // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
11: // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
12: // POSSIBILITY OF SUCH DAMAGE.
13: //
14: // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
15: package com.metaboss.applications.designstudio.auxilarydialogs;
16:
17: import java.awt.BorderLayout;
18: import java.awt.Color;
19: import java.awt.Dimension;
20: import java.awt.Graphics;
21:
22: import javax.swing.ImageIcon;
23: import javax.swing.JLabel;
24: import javax.swing.JPanel;
25:
26: import com.metaboss.applications.designstudio.Application;
27: import com.metaboss.applications.designstudio.icons.IconsHolder;
28: import com.metaboss.licensing.LicenseService;
29:
30: /* Splash Screen content panel class */
31:
32: public class SplashPanel extends JPanel {
33: private ImageIcon mBarIcon = IconsHolder
34: .loadIcon("Splash_MBDS.gif");
35: private ImageIcon mTextIcon = IconsHolder.loadIcon("MBDS-Text.png");
36: private String mCopyRight = null;;
37: private String mVersion = Application.getVersionString();
38:
39: public SplashPanel() throws Exception {
40: super ();
41:
42: // Obtain information for license service
43: javax.naming.Context lCtx = new javax.naming.InitialContext();
44: LicenseService lLicenseService = (LicenseService) lCtx
45: .lookup(LicenseService.COMPONENT_URL);
46: mCopyRight = lLicenseService.getManufacturerCopyrightNotice();
47:
48: setLayout(new BorderLayout());
49: setFont(Application.DEFAULT_FONT);
50:
51: JLabel lLabel = new JLabel();
52: lLabel.setIcon(mBarIcon);
53: add(lLabel, BorderLayout.CENTER);
54: }
55:
56: public ImageIcon getImage() {
57: return mBarIcon;
58: }
59:
60: public void paint(Graphics g) {
61: super .paint(g);
62:
63: Dimension lSize = getSize();
64: // caption
65: int x = (int) lSize.getWidth() - mTextIcon.getIconWidth() - 5;
66: mTextIcon.paintIcon(this , g, x, 10);
67: // version
68: g.setColor(Color.black);
69: int y = 10 + mTextIcon.getIconHeight() + 20;
70: int lyStep = getFontMetrics(g.getFont()).getHeight() / 2;
71: int lxStep = (int) getFontMetrics(g.getFont()).getStringBounds(
72: mVersion, g).getWidth();
73: x = lSize.width - lxStep - 12;
74: g.drawString(mVersion, x, y);
75: // copyright
76: g.setColor(Color.white);
77: lxStep = (int) getFontMetrics(g.getFont()).getStringBounds(
78: mCopyRight, g).getWidth();
79: x = lSize.width - lxStep - 12;
80: y = lSize.height - lyStep;
81: g.drawString(mCopyRight, x, y);
82: }
83: }
|