Example usage for java.awt SplashScreen getBounds

List of usage examples for java.awt SplashScreen getBounds

Introduction

In this page you can find the example usage for java.awt SplashScreen getBounds.

Prototype

public Rectangle getBounds() throws IllegalStateException 

Source Link

Document

Returns the bounds of the splash screen window as a Rectangle .

Usage

From source file:Main.java

public static void main(String args[]) throws Exception {
    SplashScreen splash = SplashScreen.getSplashScreen();
    Graphics2D g = (Graphics2D) splash.createGraphics();
    System.out.println(splash.getBounds());
    Dimension dim = splash.getSize();
    for (int i = 0; i < 100; i++) {
        g.setColor(Color.RED);/*w ww  .ja v  a  2  s. co  m*/
        g.fillRect(50, 50, dim.width - 100, dim.height - 100);
        splash.update();
        try {
            Thread.sleep(250);
        } catch (InterruptedException ignored) {
        }
    }
    JFrame frame = new JFrame("Splash Me2");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel label = new JLabel("Hello, Splash", JLabel.CENTER);
    frame.add(label, BorderLayout.CENTER);
    frame.setSize(300, 95);
    frame.setVisible(true);
}

From source file:edu.stanford.epadd.launcher.Splash.java

public Splash() {
    final SplashScreen splash = (System.getProperty("nobrowseropen") == null) ? SplashScreen.getSplashScreen()
            : null;/*  www .  j a  v a 2  s .c  o  m*/
    if (splash == null) {
        System.out.println("SplashScreen.getSplashScreen() returned null");
        return;
    }
    Rectangle r = splash.getBounds();
    g = splash.createGraphics();
    if (g == null) {
        System.out.println("splash.createGraphics() returned null");
        return;
    }
    System.out.println("splash url = " + splash.getImageURL() + " w=" + r.getWidth() + " h=" + r.getHeight()
            + " size=" + r.getSize() + " loc=" + r.getLocation());
    //      setVisible(true);
    //      toFront();
}

From source file:edu.stanford.epadd.launcher.Splash.java

public Splash() {
    final SplashScreen splash = (System.getProperty("nobrowseropen") == null) ? SplashScreen.getSplashScreen()
            : null;/*from   ww w  .j  a v a 2 s. c  om*/
    if (splash == null) {
        System.out.println("SplashScreen.getSplashScreen() returned null");
        return;
    }
    Rectangle r = splash.getBounds();
    g = splash.createGraphics();
    if (g == null) {
        System.out.println("splash.createGraphics() returned null");
        return;
    }

    /* code to prevent text from appearing too pixelated - https://stackoverflow.com/questions/31536952/how-to-fix-text-quality-in-java-graphics */
    Map<?, ?> desktopHints = (Map<?, ?>) Toolkit.getDefaultToolkit()
            .getDesktopProperty("awt.font.desktophints");
    if (desktopHints != null) {
        g.setRenderingHints(desktopHints);
    }
    System.out.println("splash url = " + splash.getImageURL() + " w=" + r.getWidth() + " h=" + r.getHeight()
            + " size=" + r.getSize() + " loc=" + r.getLocation());
    //      setVisible(true);
    //      toFront();
}