Example usage for javax.swing JFrame getContentPane

List of usage examples for javax.swing JFrame getContentPane

Introduction

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

Prototype

public Container getContentPane() 

Source Link

Document

Returns the contentPane object for this frame.

Usage

From source file:Main.java

public static void main(String[] args) {
    NumberFormat numberFormatGuFalse = NumberFormat.getNumberInstance();
    numberFormatGuFalse.setGroupingUsed(false);
    JFormattedTextField jftFieldGuFalse = new JFormattedTextField(numberFormatGuFalse);

    NumberFormat numberFormatGuTrue = NumberFormat.getNumberInstance();
    // numberFormatGuFalse.setGroupingUsed(true); // not necessary as is default
    JFormattedTextField jftFieldGuTrue = new JFormattedTextField(numberFormatGuTrue);

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(jftFieldGuFalse, BorderLayout.NORTH);
    panel.add(jftFieldGuTrue, BorderLayout.SOUTH);

    JFrame frame = new JFrame();
    frame.getContentPane().add(panel);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();/*  ww  w  .  j  a  va  2  s . co m*/
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}

From source file:ColorPan.java

public static void main(String[] args) {
    JFrame frame = new JFrame("ColorPan");
    frame.getContentPane().add(new ColorPan());
    frame.setSize(300, 300);/* w  w w .  j a v  a  2  s  .c  o  m*/
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:TexturePaintFill.java

public static void main(String[] args) throws Exception {
    JFrame f = new JFrame();
    f.getContentPane().add(new TexturePaintFill());
    f.setSize(350, 250);/*from   w w  w.j  a v  a 2  s  .c om*/
    f.show();
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("ColorPan");
    frame.getContentPane().add(new Main());
    frame.setSize(300, 300);// w  w  w .j  av  a2  s . co m
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:ImageTest.java

public static void main(String[] args) {
    ImagePanel panel = new ImagePanel(new ImageIcon("images/background.png").getImage());

    JFrame frame = new JFrame();
    frame.getContentPane().add(panel);
    frame.pack();// ww  w .  j  ava  2s  .  c  o  m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    String[] ITEMS1 = { "one", "two", "three", "four", "five" };
    String[] ITEMS2 = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" };

    JPanel northPanel = new JPanel();
    northPanel.add(new JCheckBox("Reminder"));
    northPanel.add(new JComboBox(ITEMS1));
    northPanel.add(new JComboBox(ITEMS2));

    JPanel p = new JPanel(new BorderLayout());

    p.add(northPanel, BorderLayout.NORTH);
    p.add(new JScrollPane(new JTextArea(8, 30)), BorderLayout.CENTER);

    JFrame frame = new JFrame();
    frame.getContentPane().add(p);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();// www  .j  a  va 2 s .  c o  m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame jf = new JFrame();
    Container cp = jf.getContentPane();
    MyCanvas tl = new MyCanvas();
    cp.add(tl);//from  ww  w  .  j  a  va 2s  .  co m
    jf.setSize(300, 200);
    jf.setVisible(true);
}

From source file:FontDerivation.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new FontDerivation());
    f.setSize(350, 250);/*from  w ww .ja va 2  s  .c o  m*/
    f.show();
}

From source file:Main.java

public static void main(String[] args) {
    JComboBox<String> combo = new JComboBox<>(new String[] { "One", "Two", "Three" });
    JButton arrowBtn = getButtonSubComponent(combo);
    if (arrowBtn != null) {
        arrowBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("arrow button pressed");
            }/*  w  w  w  .  j  a v a  2s.  c  om*/
        });
    }
    JFrame f = new JFrame();
    f.getContentPane().add(combo);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.pack();
    f.setVisible(true);
}

From source file:TextHitInfoDemo.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new TextHitInfoDemo());
    f.setSize(200, 200);//from   w w  w  .  j  a v  a  2 s .c  o  m
    f.show();
}