List of usage examples for javax.swing JFrame setDefaultCloseOperation
@BeanProperty(preferred = true, enumerationValues = { "WindowConstants.DO_NOTHING_ON_CLOSE", "WindowConstants.HIDE_ON_CLOSE", "WindowConstants.DISPOSE_ON_CLOSE", "WindowConstants.EXIT_ON_CLOSE" }, description = "The frame's default close operation.") public void setDefaultCloseOperation(int operation)
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JToggleButton("Press Me"); jb.setDisabledIcon(new MyIcon()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb);// w w w. j a v a 2s . c o m f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JToggleButton("Press Me"); jb.setDisabledSelectedIcon(new MyIcon()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb);//from w ww . ja v a2s . co m f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SpinnerModel model = new SpinnerNumberModel(50, 0, 100, .25); JSpinner spinner = new JSpinner(model); JComponent editor = new JSpinner.NumberEditor(spinner, "#,##0.###"); spinner.setEditor(editor);// w ww . j ava2 s . c o m JPanel panel1 = new JPanel(new BorderLayout()); panel1.add(spinner, BorderLayout.CENTER); frame.add(panel1, BorderLayout.SOUTH); frame.setSize(200, 90); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel outerPanel = new JPanel(new BorderLayout()); JPanel topPanel = new JPanel(new BorderLayout()); JLabel label = new JLabel("Name:"); JTextField text = new JTextField(); topPanel.add(label, BorderLayout.BEFORE_LINE_BEGINS); topPanel.add(text, BorderLayout.CENTER); outerPanel.add(topPanel, BorderLayout.AFTER_LAST_LINE); frame.add(outerPanel);//from w ww. j av a 2 s . com frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new Main()); f.pack();//from www . j ava 2s. c om f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Main demo = new Main(); frame.setContentPane(demo.createMenuBar()); frame.setSize(300, 100);/*from w w w.jav a 2 s . com*/ frame.setVisible(true); }
From source file:SwingSplitSample.java
public static void main(String args[]) { JFrame frame = new JFrame("JSplitPane Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSplitPane splitPane = new JSplitPane(); splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT); frame.getContentPane().add(splitPane, BorderLayout.CENTER); frame.setSize(300, 200);/*from ww w .j a v a 2 s. c o m*/ frame.setVisible(true); }
From source file:AddingChangeListenerToJSpinner.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JSpinner dateSpinner = new JSpinner(); dateSpinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { SpinnerModel dateModel = dateSpinner.getModel(); System.out.println(dateModel.getValue()); }//from w w w.j ava 2 s.c o m }); frame.add(dateSpinner, "North"); frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JDesktopPane dp = new JDesktopPane(); JInternalFrame inf = new JInternalFrame("Help", true, true, true, true); inf.setSize(200, 200);//from ww w . j av a 2s. com inf.setVisible(true); dp.add(inf); JButton btn = new JButton("Click"); btn.addActionListener(e -> JOptionPane.showInternalInputDialog(inf, "Hit me")); inf.add(btn); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new BorderLayout()); f.add(dp); f.setSize(400, 400); f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("Oval Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Main()); frame.setSize(300, 200);/* w w w .j a v a2 s . c o m*/ frame.setVisible(true); }