Example usage for javax.swing JWindow setBounds

List of usage examples for javax.swing JWindow setBounds

Introduction

In this page you can find the example usage for javax.swing JWindow setBounds.

Prototype

public void setBounds(int x, int y, int width, int height) 

Source Link

Document

The width or height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .

Usage

From source file:Main.java

public static void main(String args[]) {
    JWindow window = new JWindow();
    window.getContentPane().add(new JLabel("Loading", SwingConstants.CENTER));
    window.setBounds(500, 150, 300, 200);
    window.setVisible(true);/*ww w  . j a  v  a  2s.  com*/
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
    }
    window.setVisible(false);
    JFrame frame = new JFrame();
    frame.add(new JLabel("Welcome Swing application..."));
    frame.setVisible(true);
    frame.setSize(300, 200);
    window.dispose();
}

From source file:SimpleSplashScreen.java

public static void main(String[] arg) {
    JWindow jwin = new JWindow();
    jwin.getContentPane().add(new JLabel("Loading ZIP/JAR Manager...", SwingConstants.CENTER));
    jwin.setBounds(200, 200, 200, 100);
    jwin.setVisible(true);//from  w  w w.  j  a va2 s . c om

    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    jwin.setVisible(false);
    jwin.dispose();

}