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) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setSelected(true);/*from   w  ww .  j  a v  a2  s. com*/

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setMnemonic((int) 'P');

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();//from  w  w  w .j  a va2s. c om
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JButton("Press Me");
    System.out.println(jb.getHorizontalTextPosition());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();//from w w  w . j a v a2s  .c o m
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    System.out.println(jb.getDisabledIcon());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();/*from w  w w. j  a  v  a  2s .c  o  m*/
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setEnabled(false);//from   w  ww.j  av  a  2s . c o  m

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setDisplayedMnemonicIndex(1);/*from www. j av a2  s .  co  m*/

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JButton("Press Me");
    jb.setBorderPainted(false);/*from  w  w w  . ja  va  2s . c  om*/

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
}

From source file:ImageTest.java

public static void main(String[] args) {
    JPanel panel = new JPanel();
    final ImageButton button = new ImageButton("button.png");
    button.setPressedIcon(new ImageIcon("down.png"));
    button.setRolloverIcon(new ImageIcon("over.png"));
    button.setSelectedIcon(new ImageIcon("sel.png"));
    button.setRolloverSelectedIcon(new ImageIcon("sel-over.png"));
    button.setDisabledIcon(new ImageIcon("disabled.png"));
    button.setDisabledSelectedIcon(new ImageIcon("disabled-selected.png"));
    button.setLocation(60, 74);//from  ww  w  .  ja v  a2  s .c  o m
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            button.setSelected(!button.isSelected());
            System.out.println("selecting");
        }
    });
    // button.setSelected(true);
    // button.setDisabled(false);
    panel.add(button);

    JFrame frame = new JFrame();
    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    System.out.println(jb.getDisabledSelectedIcon());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();//from   ww w  . j ava  2s.  c o  m
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setFocusPainted(false);//from   w  w  w  .  j av  a  2  s .  c om

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
}