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) { JPanel mainPanel = new JPanel(); JTextField field = new JTextField(20); JTextField field1 = new JTextField(20); field.getDocument().addDocumentListener(new DocumentListener() { @Override//from w w w. ja va2 s . co m public void changedUpdate(DocumentEvent e) { updateLabel(e); } @Override public void insertUpdate(DocumentEvent e) { updateLabel(e); } @Override public void removeUpdate(DocumentEvent e) { updateLabel(e); } private void updateLabel(DocumentEvent e) { field1.setText(field.getText()); } }); mainPanel.setLayout(new GridLayout(1, 0, 10, 0)); mainPanel.add(field); mainPanel.add(field1); JFrame frame = new JFrame(); frame.getContentPane().add(mainPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { String title = (args.length == 0 ? "TextArea Example" : args[0]); JFrame frame = new JFrame(title); Container content = frame.getContentPane(); content.setLayout(new GridLayout(0, 2)); JTextArea leftTextArea = new JTextArea(); content.add(leftTextArea);//from www .j a v a 2s . c o m leftTextArea.paste(); JTextArea rightTextArea = new JTextArea() { public boolean isManagingFocus() { return false; } }; rightTextArea.paste(); JScrollPane rightPane = new JScrollPane(rightTextArea); content.add(rightPane); frame.setSize(250, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JToggleButton("Press Me"); jb.setSelected(true);// w w w. j a v a2 s. co m System.out.println(jb.isContentAreaFilled()); 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);//from ww w . ja v a2 s.co m System.out.println(jb.isSelected()); 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[]) { JFrame frame = new JFrame(""); Container contentPane = frame.getContentPane(); Icon icon = new PieIcon(Color.red); JButton b = new JButton("Button!", icon); contentPane.add(b, BorderLayout.NORTH); b = new JButton(icon); contentPane.add(b, BorderLayout.SOUTH); frame.setSize(300, 200);/* w w w . j av a 2 s .c o m*/ frame.show(); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JToggleButton("Press Me"); jb.setSelected(true);//www . ja v a 2 s . c o m System.out.println(jb.getText()); 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);/*from w w w. j av a2 s .co m*/ System.out.println(jb.isRolloverEnabled()); 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);//from w w w .ja v a2 s. c om System.out.println(jb.isFocusPainted()); 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);//from w w w .ja v a2s . c o m System.out.println(jb.getVerticalTextPosition()); 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);//from ww w.j a v a 2 s.co m System.out.println(jb.getMargin()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack(); f.setVisible(true); }