List of usage examples for javax.swing JFrame getContentPane
public Container getContentPane()
contentPane
object for this frame. From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JButton("Press Me"); System.out.println(jb.getMnemonic()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack();//from w ww. ja v a2 s. c o m f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JButton("Press Me"); System.out.println(jb.getRolloverIcon()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack();/* w ww . ja v a2 s . co m*/ f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JToggleButton("Press Me"); jb.setMnemonic('P'); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack();/*from ww w .j a v a 2s. co 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.getDisplayedMnemonicIndex()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack();/*from w ww .j a va 2s.c o m*/ f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JButton("Press Me"); System.out.println(jb.getSelectedIcon()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack();/* w w w . j a v a 2 s.com*/ f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JButton("Press Me"); System.out.println(jb.getRolloverSelectedIcon()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack();/*from www.j av a 2s. c o m*/ f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JButton("Press Me"); System.out.println(jb.getHorizontalAlignment() == SwingConstants.LEFT); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack();/*from ww w .j a v a 2s . co m*/ f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { String[] items = new String[] { "", "Apple", "Banana", "Carrot" }; Color bgColor = UIManager.getColor("TextField.background"); UIManager.put("ComboBox.selectionBackground", new ColorUIResource(bgColor)); JComboBox<String> combo1 = new JComboBox<>(items); combo1.setPrototypeDisplayValue("XXXXXXXXXXXXXXX"); combo1.setEditable(true);/*from ww w. j av a2 s. c om*/ combo1.setSelectedIndex(-1); JComboBox<String> combo2 = new JComboBox<>(items); combo2.setPrototypeDisplayValue("XXXXXXXXXXXXXXX"); combo2.setEditable(false); combo2.setSelectedIndex(-1); combo2.setBackground(bgColor); JFrame frame = new JFrame(); Container c = frame.getContentPane(); c.setLayout(new FlowLayout()); c.add(combo1); c.add(combo2); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 100); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JToggleButton("Press Me"); jb.setSelected(true);/*from w w w. j a va 2s. co m*/ System.out.println(jb.isBorderPainted()); 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.setSelected(true);// w ww . ja v a 2 s .c om System.out.println(jb.getIcon()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack(); f.setVisible(true); }