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:Main.java

public static void main(String[] args) {
    JTextField firstField = new JTextField(10);
    JTextField middleField = new JTextField(10);
    JTextField lastField = new JTextField(10);

    JLabel firstLabel = new JLabel("First Name", JLabel.RIGHT);
    firstLabel.setDisplayedMnemonic('F');
    firstLabel.setLabelFor(firstField);//from  w ww .  j a va 2 s .  c o  m

    JLabel middleLabel = new JLabel("Middle Initial", JLabel.RIGHT);
    middleLabel.setDisplayedMnemonic('I');
    middleLabel.setDisplayedMnemonicIndex(7);
    middleLabel.setLabelFor(middleField);

    JLabel lastLabel = new JLabel("Last Name", JLabel.RIGHT);
    lastLabel.setDisplayedMnemonic('L');
    lastLabel.setLabelFor(lastField);

    JPanel p = new JPanel();
    p.setLayout(new GridLayout(3, 2, 5, 5));
    p.add(firstLabel);
    p.add(firstField);
    p.add(middleLabel);
    p.add(middleField);
    p.add(lastLabel);
    p.add(lastField);

    JFrame f = new JFrame("MnemonicLabels");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setContentPane(p);
    f.pack();
    f.setVisible(true);
}

From source file:SwingScrollBarExample.java

public static void main(String s[]) {
    JFrame frame = new JFrame("Scroll Bar Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(new SwingScrollBarExample());
    frame.setSize(200, 200);/*from   w w w  .  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);
    frame.setContentPane(new Main());
    frame.pack();/*  ww w. j a va2 s .c  om*/
    frame.setVisible(true);
}

From source file:ListModelExample.java

public static void main(String s[]) {
    JFrame frame = new JFrame("List Model Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(new ListModelExample());
    frame.setSize(260, 200);//from   ww w .ja va 2s  .c  o m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String s[]) {
    JFrame frame = new JFrame("List Model Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(new Main());
    frame.setSize(260, 200);//  w  w  w.  ja v a 2 s .c o  m
    frame.setVisible(true);
}

From source file:RoundedLineBorder.java

public static void main(String s[]) {
    JFrame frame = new JFrame("Rounded Line Border");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(500, 200);//  w ww.j av a2s  . c  o m
    frame.setContentPane(new RoundedLineBorder());
    frame.setVisible(true);
}

From source file:MatteExample.java

public static void main(String s[]) {
    JFrame frame = new JFrame("Matte Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(500, 200);//from  ww  w . ja  va  2  s  .co  m
    frame.setContentPane(new MatteExample());
    frame.setVisible(true);
}

From source file:SimpleList2.java

public static void main(String s[]) {
    JFrame frame = new JFrame("List Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(new SimpleList2());
    frame.pack();// w  w w  . j a v a 2  s  . c  o  m
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(String args[]) {
    final MainClass it = new MainClass();

    JFrame frame = new JFrame("Progress Bar Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(it);
    frame.pack();/*from   ww w.  j a  v a2s.c o m*/
    frame.setVisible(true);

    for (int i = MY_MINIMUM; i <= MY_MAXIMUM; i++) {
        final int percent = i;
        try {
            SwingUtilities.invokeAndWait(new Runnable() {
                public void run() {
                    it.updateBar(percent);
                }
            });

            java.lang.Thread.sleep(100);

        } catch (Exception e) {
            ;
        }
    }
}

From source file:Main.java

public static void main(String args[]) {
    final Main it = new Main();

    JFrame frame = new JFrame("Progress Bar Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(it);
    frame.pack();/*from   www.j a v  a  2 s. co m*/
    frame.setVisible(true);

    for (int i = MY_MINIMUM; i <= MY_MAXIMUM; i++) {
        final int percent = i;
        try {
            SwingUtilities.invokeAndWait(new Runnable() {
                public void run() {
                    it.updateBar(percent);
                }
            });

            java.lang.Thread.sleep(100);

        } catch (Exception e) {
            ;
        }
    }
}