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) {
    JFrame frame = new JFrame();
    frame.getContentPane().setBackground(Color.PINK);
    frame.setSize(200, 200);//from w  w  w.j  ava 2s. c o  m
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

From source file:DrawSimpleText.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new DrawSimpleText());
    f.setSize(300, 200);/*  www  . j  a  v a  2 s  .  c  om*/
    f.setVisible(true);
}

From source file:SimplestGradientPaint.java

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

}

From source file:TextLayoutOne.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new TextLayoutOne());
    f.setSize(300, 200);// ww  w .  j  av  a  2  s  .co m
    f.setVisible(true);

}

From source file:SimpleFont.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new SimpleFont());
    f.setSize(350, 250);/*from  w  w w.jav a 2s  .co m*/
    f.show();
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JFileChooser chooser = new JFileChooser();
    File file = new File("filename.txt");
    Icon icon = chooser.getIcon(file);

    JLabel label = new JLabel("" + file);
    label.setIcon(icon);/* ww w . j a  v a  2s .c  om*/
    JFrame frame = new JFrame();
    frame.getContentPane().add(label, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
}

From source file:XORRectangles.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new XORRectangles());
    f.setSize(300, 200);/*from ww  w  .ja  va 2s  .c  o m*/
    f.setVisible(true);
}

From source file:IteratorUnderStrike.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new IteratorUnderStrike());
    f.setSize(850, 250);//from   www.  j a va 2  s . co  m
    f.show();
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.getContentPane().add(new Main());

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.setSize(200, 200);//from ww  w .j  a va  2  s.com
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    File file = new File(args[0]);
    sun.awt.shell.ShellFolder sf = sun.awt.shell.ShellFolder.getShellFolder(file);
    Icon icon = new ImageIcon(sf.getIcon(true));
    System.out.println("type = " + sf.getFolderType());

    JLabel label = new JLabel(icon);
    JFrame frame = new JFrame();
    frame.getContentPane().add(label);
    frame.pack();/*from  ww w .  j av  a 2  s.c  om*/
    frame.setVisible(true);

}