001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library located in LGPL.txt in the
021: * license directory; if not, write to the
022: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023: * Boston, MA 02111-1307, USA.
024: *
025: * If this agreement does not cover your requirements, please contact us
026: * via email to get detailed information about the commercial license
027: * or our service offerings!
028: *
029: */
030: // @@
031: package de.ug2t.channel.ho.client.swing;
032:
033: import java.awt.*;
034:
035: import javax.swing.*;
036:
037: import de.ug2t.kernel.*;
038:
039: public class HoSwingSplashScreen extends Thread {
040: private JWindow pem_splash = null;
041: private HoSwingImage pem_image = null;
042: private Frame pem_parent = null;
043: private volatile int pem_time;
044: private volatile boolean pem_showing = true;
045:
046: public HoSwingSplashScreen(HoSwingImage xImage, Frame xParent) {
047: this .pem_image = xImage;
048: this .pem_parent = xParent;
049:
050: this .pem_splash = new JWindow(this .pem_parent);
051: this .pem_splash.getContentPane().add(
052: pem_image.pcmf_getSwingWidget());
053:
054: Rectangle l_rect = this .pem_splash.getGraphicsConfiguration()
055: .getBounds();
056: int wi = (int) pem_image.pcmf_getSwingWidget()
057: .getPreferredSize().getWidth();
058: int hi = (int) pem_image.pcmf_getSwingWidget()
059: .getPreferredSize().getHeight();
060:
061: this .pem_splash.setBounds(
062: (int) (l_rect.getMaxX() / 2 - wi / 2), (int) (l_rect
063: .getMaxY() / 2 - hi / 2), wi, hi);
064: this .pem_splash.pack();
065: this .pem_splash.setVisible(true);
066: this .pem_splash.paint(this .pem_splash.getGraphics());
067: }
068:
069: public void run() {
070: try {
071: Thread.sleep(pem_time);
072:
073: synchronized (this ) {
074: if (this .pem_showing == true) {
075: this .pem_splash.setVisible(false);
076: this .pem_splash.dispose();
077: this .pem_showing = false;
078: }
079: ;
080: }
081: } catch (Exception e) {
082: KeLog.pcmf_logException("ug2t", this , e);
083: }
084: }
085:
086: public synchronized void pcmf_closeImmediate() {
087: synchronized (this ) {
088: if (this .pem_showing == true) {
089: this .pem_splash.setVisible(false);
090: this .pem_splash.dispose();
091: this .pem_showing = false;
092: }
093: ;
094: }
095: }
096:
097: public synchronized void pcmf_close(int xTime) {
098: this.pem_time = xTime;
099: this.start();
100: }
101: }
|