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) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setUndecorated(true);/*w w w .ja v a 2s. co m*/ JPanel panel = new JPanel(); panel.add(new JLabel("Stackoverflow!")); panel.add(new JButton(new AbstractAction("Close") { @Override public void actionPerformed(ActionEvent e) { System.exit(0); } })); f.add(panel); f.pack(); f.setVisible(true); }
From source file:DrawStringI18N.java
public static void main(String[] args) { JFrame frame = new DrawStringI18N(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200);/*from w ww . ja v a 2s . co m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { JFrame f = new JFrame("Test"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTree tree = new JTree(); tree.putClientProperty("JTree.lineStyle", "Angled"); // tree.putClientProperty("JTree.lineStyle", "Horizontal"); // tree.putClientProperty("JTree.lineStyle", "None"); for (int i = 0; i < tree.getRowCount(); i++) { tree.expandRow(i);//from w w w . j a va2s .c o m } f.add(tree); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("DefaultButton"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Icon warnIcon = new ImageIcon("yourFile.gif"); JButton button2 = new JButton(warnIcon); frame.add(button2);//ww w.j av a 2s. c o m frame.setSize(300, 200); frame.setVisible(true); }
From source file:ListSample.java
public static void main(String args[]) { String labels[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }; String title = "JList Sample"; JFrame f = new JFrame(title); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList list = new JList(labels); JScrollPane scrollPane = new JScrollPane(list); Container contentPane = f.getContentPane(); contentPane.add(scrollPane, BorderLayout.CENTER); f.setSize(200, 200);//from w ww . j a va 2s . c o m f.setVisible(true); }
From source file:Main.java
public static void main(String s[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new Main()); frame.pack();/*from ww w. j ava2 s . co m*/ frame.setVisible(true); }
From source file:GettingFontMetrics.java
public static void main(String args[]) { JFrame f = new JFrame("JColorChooser Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); FontMetrics metrics = f.getFontMetrics(f.getFont()); f.setSize(300, 200);/*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[]) { JFrame frame = new JFrame("DefaultButton"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Icon warnIcon = new ImageIcon("Warn.gif"); JButton button3 = new JButton("Warning", warnIcon); frame.add(button3);/*from ww w.j a v a 2 s .com*/ frame.setSize(300, 200); frame.setVisible(true); }
From source file:HTMLButton.java
public static void main(String args[]) { JFrame frame = new JFrame("DefaultButton"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String htmlButton = "<html><sup>HTML</sup> <sub><em>Button</em></sub><br>" + "<font color=\"#FF0080\"><u>Multi-line</u></font>"; JButton button4 = new JButton(htmlButton); frame.add(button4);/* w w w . j a va2 s.com*/ frame.setSize(300, 200); frame.setVisible(true); }
From source file:InternalFramePaletteSample.java
public static void main(final String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDesktopPane desktop = new JDesktopPane(); JInternalFrame palette = new JInternalFrame("Palette", true, false, true, false); palette.setBounds(350, 150, 100, 100); palette.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE); desktop.add(palette, JDesktopPane.PALETTE_LAYER); palette.setVisible(true);//from w ww. j av a2 s.c o m frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }