Example usage for java.awt Frame Frame

List of usage examples for java.awt Frame Frame

Introduction

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

Prototype

public Frame() throws HeadlessException 

Source Link

Document

Constructs a new instance of Frame that is initially invisible.

Usage

From source file:Main.java

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

    frame.setSize(300, 300);/* ww w.java2  s  . co  m*/
    frame.setVisible(true);

    deiconify(frame);
}

From source file:Main.java

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

    frame.setSize(300, 300);//from   w w  w. ja  va2  s. co  m
    frame.setVisible(true);

    minimize(frame);
}

From source file:Main.java

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

    frame.setSize(300, 300);/* w ww  .j a  va2 s. co  m*/
    frame.setVisible(true);

    maximize(frame);

}

From source file:Main.java

public static void main(String[] args) throws HeadlessException, AWTException {
    Frame frame = new Frame();
    Button button1 = new Button("Ok");
    frame.add(button1, BorderLayout.NORTH);
    frame.setSize(50, 55);/*from w w  w  . j a  v a 2 s . c  o m*/
    frame.setVisible(true);

    button1.setCursor(Cursor.getSystemCustomCursor("MoveDrop.32x32"));
}

From source file:MainClass.java

public static void main(String[] args) {
    JDialog d1 = new JDialog((JFrame) null, "Dialog 1");
    d1.setName("Dialog 1");

    JDialog d2 = new JDialog((Window) null, "Dialog 2");
    d2.setName("Dialog 2");

    Frame f = new Frame();
    f.setName("Frame 1");

    Window w1 = new Window(f);
    w1.setName("Window 1");

    Window w2 = new Window(null);
    w2.setName("Window 2");

    Window[] windows = Window.getWindows();
    for (Window window : windows)
        System.out.println(window.getName() + ": " + window.getClass());

}

From source file:MainClass.java

public static void main(String[] args) {
    JDialog d1 = new JDialog((JFrame) null, "Dialog 1");
    d1.setName("Dialog 1");

    JDialog d2 = new JDialog((Window) null, "Dialog 2");
    d2.setName("Dialog 2");

    Frame f = new Frame();
    f.setName("Frame 1");

    Window w1 = new Window(f);
    w1.setName("Window 1");

    Window w2 = new Window(null);
    w2.setName("Window 2");

    Window[] ownerlessWindows = Window.getOwnerlessWindows();
    for (Window window : ownerlessWindows)
        System.out.println(window.getName() + ": " + window.getClass());

}

From source file:MainClass.java

public static void main(String[] args) {
    JDialog d1 = new JDialog((JFrame) null, "Dialog 1");
    d1.setName("Dialog 1");

    JDialog d2 = new JDialog((Window) null, "Dialog 2");
    d2.setName("Dialog 2");

    Frame f = new Frame();
    f.setName("Frame 1");

    Window w1 = new Window(f);
    w1.setName("Window 1");

    Window w2 = new Window(null);
    w2.setName("Window 2");

    System.out.println("FRAME WINDOWS");
    Frame[] frames = Frame.getFrames();
    for (Frame frame : frames)
        System.out.println(frame.getName() + ": " + frame.getClass());

}

From source file:HelloWorld.java

public static void main(String[] args) {
    Frame frame = new Frame();
    frame.setSize(640, 480);/*w ww  .ja  v a2  s . c om*/
    frame.setLayout(new BorderLayout());

    Canvas3D canvas = new Canvas3D(null);
    frame.add("Center", canvas);

    SimpleUniverse univ = new SimpleUniverse(canvas);
    univ.getViewingPlatform().setNominalViewingTransform();

    BranchGroup scene = createSceneGraph();
    scene.compile();
    univ.addBranchGraph(scene);

    frame.show();
}

From source file:Main.java

public static void main(String args[]) {
    Frame f = new Frame();
    JPanel mgb = new Main();
    f.add("Center", mgb);
    f.pack();//from  w  w  w  .j a  va 2 s. c  o  m
    f.setSize(300, 300);
    f.setVisible(true);
}

From source file:FullScreen.java

public static void main(String args[]) {
    GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice();
    DisplayMode originalDisplayMode = graphicsDevice.getDisplayMode();

    try {/*from  w ww. ja v  a2 s  .co  m*/
        Frame frame = new Frame();
        frame.setUndecorated(true);
        frame.setIgnoreRepaint(true);
        graphicsDevice.setFullScreenWindow(frame);
        if (graphicsDevice.isDisplayChangeSupported()) {
            graphicsDevice.setDisplayMode(getBestDisplayMode(graphicsDevice));
        }
        frame.createBufferStrategy(2); // 2 buffers
        Rectangle bounds = frame.getBounds();
        BufferStrategy bufferStrategy = frame.getBufferStrategy();
        while (!done()) {
            Graphics g = null;
            try {
                g = bufferStrategy.getDrawGraphics();
                if ((counter <= 2)) { // 2 buffers
                    g.setColor(Color.CYAN);
                    g.fillRect(0, 0, bounds.width, bounds.height);
                }
                g.setColor(Color.RED);
                // redraw prior line, too, since 2 buffers
                if (counter != 1) {
                    g.drawLine(counter - 1, (counter - 1) * 5, bounds.width, bounds.height);
                }
                g.drawLine(counter, counter * 5, bounds.width, bounds.height);
                bufferStrategy.show();
            } finally {
                if (g != null) {
                    g.dispose();
                }
            }
            try {
                Thread.sleep(250);
            } catch (InterruptedException ignored) {
            }
        }
    } finally {
        graphicsDevice.setDisplayMode(originalDisplayMode);
        graphicsDevice.setFullScreenWindow(null);
    }
    System.exit(0);
}