Example usage for javax.swing JWindow JWindow

List of usage examples for javax.swing JWindow JWindow

Introduction

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

Prototype

public JWindow() 

Source Link

Document

Creates a window with no specified owner.

Usage

From source file:MainClass.java

public static void main(String[] args) {
    JWindow w = new JWindow();
    w.setSize(300, 300);/*from  www .j a  v  a  2s .  com*/
    w.setLocation(500, 100);

    w.setVisible(true);
}

From source file:Main.java

public static void main(String s[]) {
    JWindow win = new JWindow();

    JPanel pan = new JPanel();
    win.add(pan, "Center");

    pan.setLayout(new FlowLayout());
    pan.add(new JButton("Hello"));

    win.setSize(200, 200);// www  . ja v  a2s  .  c  om
    win.setVisible(true);
}

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);/* w  ww. j a  v a 2 s .c  o  m*/
    jwin.setVisible(true);

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

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

}

From source file:Main.java

License:asdf

public static void main(String[] argv) throws Exception {
    JWindow window = new JWindow();

    JButton component = new JButton("asdf");
    // Add component to the window
    window.getContentPane().add(component, BorderLayout.CENTER);

    // Set initial size
    window.setSize(300, 300);/*from   w ww.  jav  a2 s .co m*/

    // Show the window
    window.setVisible(true);

}

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);/*from  w  ww. j  a v a  2  s . c  o  m*/
    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:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame("The Frame");
    f.setSize(300, 300);//from   w  ww .j  a va  2 s .  c  o  m
    f.setLocation(100, 100);

    JWindow w = new JWindow();
    w.setSize(300, 300);
    w.setLocation(500, 100);

    f.setVisible(true);
    w.setVisible(true);
}

From source file:Main.java

/**
 * Returns a window with a partially opaque progress Icon. Sets the opacity, location and size (to the given icon
 * size) (does not pack the image)//from   ww  w .  j av a 2s  .  c  o  m
 *
 * @param icon the icon to set in the progress window
 * @param opacity a float value from 0-1
 * @param x the x location of the window
 * @param y the y location of the window
 * @return a jWindow of the progress wheel
 */
public static JWindow getProgressWheelWindow(final Icon icon, final Float opacity, final int x, final int y) {
    JWindow jWindow = new JWindow() {

        {
            setOpacity(opacity);
            setLocation(x, y);
            setSize(icon.getIconWidth(), icon.getIconHeight());
            add(new JLabel(icon));
        }
    };

    return jWindow;
}

From source file:com.totsp.sotu.app.ScreenAreaWatcher.java

/** Creates a new instance of ScreenWatcher */
public ScreenAreaWatcher(final Configuration config) throws AWTException {
    super();/*from   www  . ja v a2 s .c  o m*/
    this.config = config;
    System.out.println(config.getWidth() + "x" + config.getHeight());
    JPanel jp = null;

    JWindow top = new JWindow();
    top.setBackground(GREEN);
    top.setLocation(0, 0);
    top.setAlwaysOnTop(true);
    jp = new JPanel();
    jp.setBackground(GREEN);
    top.add(jp);
    top.pack();
    top.setSize(config.getWidth(), config.getBorderSize());

    JWindow bottom = new JWindow();
    bottom.setBackground(GREEN);
    bottom.setLocation(0, config.getHeight() - config.getBorderSize());
    bottom.setAlwaysOnTop(true);
    jp = new JPanel();
    jp.setBackground(GREEN);
    bottom.add(jp);
    bottom.pack();
    bottom.setSize(config.getWidth(), config.getBorderSize());

    JWindow left = new JWindow();
    left.setBackground(GREEN);
    left.setLocation(0, 0);
    left.setAlwaysOnTop(true);
    jp = new JPanel();
    jp.setBackground(GREEN);
    left.add(jp);
    left.pack();
    left.setSize(config.getBorderSize(), config.getHeight());

    JWindow right = new JWindow();
    right.setLocation(config.getWidth() - config.getBorderSize(), 0);
    right.setAlwaysOnTop(true);
    jp = new JPanel();
    jp.setBackground(GREEN);
    right.add(jp);
    right.pack();
    right.setSize(config.getBorderSize(), config.getHeight());

    top.setVisible(true);
    bottom.setVisible(true);
    left.setVisible(true);
    right.setVisible(true);

    windows = new JWindow[4];
    windows[0] = top;
    windows[1] = bottom;
    windows[2] = left;
    windows[3] = right;

    MouseInputAdapter adapter = new Adapter(windows);

    top.addMouseListener(adapter);
    top.addMouseMotionListener(adapter);
    bottom.addMouseListener(adapter);
    bottom.addMouseMotionListener(adapter);
    left.addMouseListener(adapter);
    left.addMouseMotionListener(adapter);
    right.addMouseListener(adapter);
    right.addMouseMotionListener(adapter);

    timer.schedule(new ImageUpdateTimerTask(this), 0, config.getMaxUpdateInterval());

    this.addPropertyChangeListener("image", new PropertyChangeListener() {
        HttpClient client = new HttpClient();

        public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            BufferedImage img = (BufferedImage) propertyChangeEvent.getNewValue();
            try {
                File outputFile = File.createTempFile("save-" + System.currentTimeMillis(), ".png");
                JAI.create("filestore", img, outputFile.getCanonicalPath(), "PNG", null);
                System.out.println("Temp File:  " + outputFile.getCanonicalPath());
                MultipartPostMethod method = new MultipartPostMethod(
                        config.getServerUrl() + "/ImagePublishingServlet");
                method.addParameter("adminPassword", config.getAdminPassword());
                method.addParameter("conversation", config.getConversationName());
                method.addParameter("image", outputFile);
                client.executeMethod(method);

            } catch (Exception e) {
                System.err.println("Error handling image");
                e.printStackTrace();
            }
        }

    });
}

From source file:org.nebulaframework.ui.swing.cluster.ClusterMainUI.java

/**
 * Displays Splash Screen//from ww w .  ja v a 2 s . com
 * 
 * @return Splash Screen Reference
 */
public static JWindow showSplash() {

    JWindow splash = new JWindow();
    splash.setSize(400, 250);
    splash.setLayout(null);

    JLabel status = new JLabel("Developed by Yohan Liyanage, 2008");
    JLabelAppender.setLabel(status);
    status.setFont(new Font("sansserif", Font.PLAIN, 10));
    status.setSize(350, 30);
    status.setLocation(10, 220);
    splash.add(status);

    JLabel lbl = new JLabel(
            new ImageIcon(ClassLoader.getSystemResource("META-INF/resources/nebula-startup.png")));
    lbl.setSize(400, 250);
    lbl.setLocation(0, 0);
    splash.add(lbl);

    splash.setVisible(true);
    splash.setLocationRelativeTo(null);

    return splash;
}