/*

 * Title: japlot.jaxodraw
 * Description: Graphical user interface for drawing Feynman diagrams
 * @author Daniele Binosi 
 * @author Lukas Theussl  

 Copyright (C) 2003-2006,  Daniele Binosi and Lukas Theussl

 See the file LICENSE in the source distribution home directory
 for a full copy of the GPL (GNU General Public License).

    This file is part of japlot.jaxodraw.

    japlot.jaxodraw is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    japlot.jaxodraw is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


 */
package japlot.jaxodraw;

import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;


/** The splash window displayed on startup. */
public class JaxoSplashWindow extends Component {
    private Frame frame;
    private Image image;

    /** Constructor. */
    public JaxoSplashWindow() {
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        image =
            getToolkit().getImage(getClass().getClassLoader().getResource("japlot/jaxodraw/icons/start.jpg"));

        int width = image.getWidth(null);
        int height = image.getHeight(null);

        do { // wait until the image is fully loaded
            width = image.getWidth(null);
            height = image.getHeight(null);
        } while (width < 0);

        Dimension screen = getToolkit().getScreenSize();

        frame = new Frame();
        frame.setSize(width, height);
        frame.setUndecorated(true);
        frame.add(this);
        frame.setLocation((screen.width - width) / 2,
            (screen.height - height) / 2);
        frame.validate();
        frame.setVisible(true);
    }

    /** Disposes the splash screen. */
    public final void dispose() {
        frame.dispose();
    }

    /** Paints the splash image.
     * @param g The graphics context to draw the splash image.
    */
    public final void paint(Graphics g) {
        g.drawImage(image, 0, 0, null);
    }
}

 

Ads help maintain this website.