Example usage for javax.swing JFrame setContentPane

List of usage examples for javax.swing JFrame setContentPane

Introduction

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

Prototype

@BeanProperty(bound = false, hidden = true, description = "The client area of the frame where child components are normally inserted.")
public void setContentPane(Container contentPane) 

Source Link

Document

Sets the contentPane property.

Usage

From source file:LineStyles.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from   w  w w  .j a va2  s.  c  o m
        }
    });
    f.setContentPane(new LineStyles());
    f.setSize(450, 200);
    f.setVisible(true);
}

From source file:ThreadViewer.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    ThreadViewer viewer = new ThreadViewer();

    f.setContentPane(viewer);
    f.setSize(500, 300);//from  w  w  w  . jav a2  s. c  o m
    f.setVisible(true);

    f.setDefaultCloseOperation(1);

    // Keep the main thread from exiting by blocking
    // on wait() for a notification that never comes.
    Object lock = new Object();
    synchronized (lock) {
        try {
            lock.wait();
        } catch (InterruptedException x) {
        }
    }
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("FocusEventDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JComponent newContentPane = new Main();
    newContentPane.setOpaque(true); // content panes must be opaque
    frame.setContentPane(newContentPane);
    frame.pack();/*from   w ww.j  a  v a 2 s .c  o  m*/
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Main newContentPane = new Main();
    frame.setContentPane(newContentPane);
    frame.pack();/* w ww.ja v  a 2  s. co  m*/
    frame.setVisible(true);
}

From source file:GrayModel.java

public static void main(String[] args) {
    JFrame frame = new JFrame("SpinnerDemo4");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JComponent newContentPane = new Main();
    newContentPane.setOpaque(true);/*w  ww  . j av  a 2s  . co m*/
    frame.setContentPane(newContentPane);

    frame.add(new JLabel("Shade of Gray:"), "North");
    frame.add(new JSpinner(new GrayModel(170)));

    frame.pack();
    frame.setVisible(true);
}

From source file:EditableComboBox.java

public static void main(String s[]) {
    JFrame frame = new JFrame("Combo Box Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(new EditableComboBox());
    frame.pack();/*w w  w  . j  ava  2s.c om*/
    frame.setVisible(true);
}

From source file:GrayModel.java

public static void main(String[] args) {
    JFrame frame = new JFrame("SpinnerDemo4");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JComponent newContentPane = new SpinnerDemo4();
    newContentPane.setOpaque(true);//  w w  w  .ja  v  a  2  s .  com
    frame.setContentPane(newContentPane);

    frame.add(new JLabel("Shade of Gray:"), "North");
    frame.add(new JSpinner(new GrayModel(170)));

    frame.pack();
    frame.setVisible(true);
}

From source file:FocusTraversalExample.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Alphabetized Button Focus Traversal");
    frame.setFocusTraversalPolicy(new AlphaButtonPolicy());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(new FocusTraversalExample());
    frame.setSize(400, 300);//  w  w w  .  j av a2  s .  c o  m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    String s = "The quick brown fox jumps over the lazy dog!";
    Font font = new Font(Font.SERIF, Font.PLAIN, 24);

    JLabel l1 = new MyLabel(s);
    l1.setFont(font);/*w ww  .  j  a  va  2s . c o m*/
    f.setContentPane(l1);
    f.pack();

    f.setVisible(true);
}

From source file:REDemo.java

/** "main program" method - construct and show */
public static void main(String[] av) {
    JFrame f = new JFrame("REDemo");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    REDemo comp = new REDemo();
    f.setContentPane(comp);
    f.pack();//  w  w  w.j av  a2  s  . c o m
    f.setLocation(200, 200);
    f.setVisible(true);
}