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[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSeparator sep = new JSeparator(JSeparator.VERTICAL); sep.setOrientation(JSeparator.VERTICAL); frame.add(sep);//ww w . jav a2s. co m frame.setSize(300, 200); frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextArea leftTextArea = new JTextArea(); frame.add(leftTextArea);/* w ww . j a v a 2s . c o m*/ leftTextArea.paste(); frame.setSize(250, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame("Test"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTable table = new JTable(new String[][] { { "One" }, { "Two" }, { "Three" } }, new String[] { "Ordinal" }); table.addRowSelectionInterval(1, 1); f.add(new JScrollPane(table)); f.pack();/*from www .j a va 2 s. c om*/ f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:HTMLDemoAbstractButton.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); AbstractButton bn = new JButton(); bn.setText("<html>Last Name<br><font face='courier new'" + " color=red> (mandatory) </font></html>"); frame.add(bn);//from w w w. j a v a2s.c o m frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String s[]) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new Main()); f.setSize(220, 220);/* w w w . j av a 2s . c o m*/ f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextPane ta = new JTextPane(); ta.setContentType("text/html"); ta.setText("<HTML><BODY><CODE> import java.io.*; <br> public class MyIO{}</CODE><br></BODY></HTML>"); JScrollPane jsp = new JScrollPane(ta); f.getContentPane().add(jsp);/*from w w w. j a v a 2 s .c o m*/ f.setSize(300, 200); f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { String subject[] = { "Math", " English", "SQL", " java", " c ", " c++ ", " cobol ", "this is a test" }; JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList<String> list = new JList<String>(subject); JScrollPane s = new JScrollPane(list); s.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); s.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); f.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); f.add(s);/*from w w w .j a v a2s. c om*/ f.setSize(300, 300); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JRootPane root = f.getRootPane(); Container content = root.getContentPane(); content.add(new JButton("Hello")); f.pack();//w w w . j a va 2 s.c om f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Hello World"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setMinimumSize(new Dimension(100, 100)); frame.setVisible(true);// w w w . j a v a 2s . co m }
From source file:RootExample.java
public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JRootPane root = f.getRootPane(); // XXX Pay attention to these Container content = root.getContentPane(); // XXX lines. They get more content.add(new JButton("Hello")); // XXX explanation in the book. f.pack();//from www. jav a 2s . com f.setVisible(true); }