List of usage examples for javax.swing JFrame JFrame
public JFrame(String title) throws HeadlessException
Frame
with the specified title. From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame("Selecting CheckBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JCheckBox checkBox = new JCheckBox("Hi"); checkBox.getModel().setEnabled(false); frame.add(checkBox, BorderLayout.NORTH); frame.setSize(300, 100);/*w w w . j a va2 s . c o m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame("Selecting CheckBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JCheckBox checkBox = new JCheckBox("Hi"); checkBox.getModel().setActionCommand("Hi"); frame.add(checkBox, BorderLayout.NORTH); frame.setSize(300, 100);/*from w ww . j av a2 s . co m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame("Selecting CheckBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JCheckBox checkBox = new JCheckBox("Hi"); checkBox.getModel().setMnemonic((char) 'H'); System.out.println(checkBox.getModel().getMnemonic()); frame.add(checkBox, BorderLayout.NORTH); frame.setSize(300, 100);// w w w . j a va 2 s .co m frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("JFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); // Add a close button JButton closeButton = new JButton("Close"); contentPane.add(closeButton);//from w w w .j a va 2 s . c o m // set the size of the frame 300 x 200 frame.setBounds(50, 50, 300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame("Selecting CheckBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JCheckBox checkBox = new JCheckBox("Hi"); checkBox.getModel().setEnabled(false); System.out.println(checkBox.getModel().isEnabled()); frame.add(checkBox, BorderLayout.NORTH); frame.setSize(300, 100);// w w w . j a v a 2 s. c o m frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame("Selecting CheckBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JCheckBox checkBox = new JCheckBox("Hi"); checkBox.getModel().setEnabled(false); System.out.println(checkBox.getModel().isRollover()); frame.add(checkBox, BorderLayout.NORTH); frame.setSize(300, 100);//www. j a v a2 s.c o m frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("JFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); // Add a close button JButton closeButton = new JButton("Close"); contentPane.add(closeButton);//from w w w . j av a 2s. c om closeButton.addActionListener(e -> System.exit(0)); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("JFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Add a close button JButton closeButton = new JButton("Close"); Container contentPane = frame.getContentPane(); contentPane.add(closeButton);//from w w w . j a v a2s.co m // Calculates and sets appropriate size for the frame frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Tool Tip Demo"); frame.setSize(200, 200);/*from w w w. ja va2s . c o m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Hover on me!"); label.setToolTipText("My JLabel Tool Tip"); frame.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER)); frame.getContentPane().add(label); frame.setVisible(true); }
From source file:ButtonFocus.java
public static void main(String args[]) { JFrame frame = new JFrame("Focus Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton focusButton = new JButton("Focused"); JButton notFocusButton = new JButton("Not Focused"); frame.setLayout(new FlowLayout()); frame.add(focusButton);//from www . ja v a 2 s. c o m frame.add(notFocusButton); frame.setSize(300, 100); frame.setVisible(true); }