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:components.TableSelectionDemo.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.//from w  w w  . j  a  v  a2s.com
 */
private static void createAndShowGUI() {
    //Disable boldface controls.
    UIManager.put("swing.boldMetal", Boolean.FALSE);

    //Create and set up the window.
    JFrame frame = new JFrame("TableSelectionDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    TableSelectionDemo newContentPane = new TableSelectionDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:DropDemo.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.//ww  w  .j  av  a2 s .co m
 */
private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("DropDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    JComponent newContentPane = new DropDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:DynamicTreeDemo.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *//*ww w .  ja va2  s .  c o  m*/
private static void createAndShowGUI() {
    // Create and set up the window.
    JFrame frame = new JFrame("DynamicTreeDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create and set up the content pane.
    DynamicTreeDemo newContentPane = new DynamicTreeDemo();
    newContentPane.setOpaque(true); // content panes must be opaque
    frame.setContentPane(newContentPane);

    // Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:TableDialogEditDemo.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread./*w  w  w .  j a v a  2 s .c om*/
 */
private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("TableDialogEditDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    JComponent newContentPane = new TableDialogEditDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:components.TreeIconDemo2.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.//  w  w w. j  ava  2 s .c om
 */
private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("TreeIconDemo2");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    TreeIconDemo2 newContentPane = new TreeIconDemo2();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:misc.ActionDemo.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the 
 * event-dispatching thread./*from  w  ww .j  av a  2s. c  o m*/
 */
private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("ActionDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create/set menu bar and content pane.
    ActionDemo demo = new ActionDemo();
    frame.setJMenuBar(demo.createMenuBar());
    demo.createToolBar();
    demo.setOpaque(true); //content panes must be opaque
    frame.setContentPane(demo);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:TextCutPaste.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *///w  ww .j  ava  2  s . c om
private static void createAndShowGUI() {
    // Create and set up the window.
    JFrame frame = new JFrame("TextCutPaste");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create and set up the menu bar and content pane.
    TextCutPaste demo = new TextCutPaste();
    frame.setJMenuBar(demo.createMenuBar());
    demo.setOpaque(true); // content panes must be opaque
    frame.setContentPane(demo);

    // Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:TreeIconDemo2.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread./*from   ww  w  .ja  va2 s . co m*/
 */
private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("TreeIconDemo2");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    TreeIconDemo2 newContentPane = new TreeIconDemo2();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:events.ListDataEventDemo.java

/** 
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.//  w ww . j  a v a  2s .c  om
 */
private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("ListDataEventDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    JComponent newContentPane = new ListDataEventDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Don't let the content pane get too small.
    //(Works if the Java look and feel provides
    //the window decorations.)
    newContentPane.setMinimumSize(new Dimension(newContentPane.getPreferredSize().width, 100));

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:TextSamplerDemo.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *//*from  w ww.ja  v a 2s .  c  o m*/
private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("TextSamplerDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    JComponent newContentPane = new TextSamplerDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}