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:ScrollBarSample.java
public static void main(String args[]) { AdjustmentListener adjustmentListener = new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent adjustmentEvent) { System.out.println("Adjusted: " + adjustmentEvent.getValue()); }/*from w ww . j a v a 2 s.co m*/ }; JScrollBar oneJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); oneJScrollBar.addAdjustmentListener(adjustmentListener); JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(oneJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200); frame.setVisible(true); }
From source file:EditorSample.java
public static void main(String args[]) { JFrame f = new JFrame("JEditorPane Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container content = f.getContentPane(); JEditorPane editor = new JEditorPane("text/html", "<H3>Help</H3><center><IMG src=file:///c:/cpress/code/Ch01/logo.jpg></center><li>One<li><i>Two</i><li><u>Three</u>"); editor.setEditable(false);//from ww w . ja v a2 s .c o m JScrollPane scrollPane = new JScrollPane(editor); content.add(scrollPane, BorderLayout.CENTER); f.setSize(300, 200); f.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Line Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border roundedBorder = new LineBorder(Color.BLACK, 12, true); JButton roundedButton = new JButton("Rounded 12 Pixel"); roundedButton.setBorder(roundedBorder); Container contentPane = frame.getContentPane(); contentPane.add(roundedButton, BorderLayout.SOUTH); frame.pack();//from w w w . j a v a 2 s . c om frame.setSize(300, frame.getHeight()); frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Line Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border thickBorder = new LineBorder(Color.WHITE, 12); JButton thickButton = new JButton("12 Pixel"); thickButton.setBorder(thickBorder);/*w w w . j a v a 2 s .co m*/ Container contentPane = frame.getContentPane(); contentPane.add(thickButton, BorderLayout.NORTH); frame.pack(); frame.setSize(300, frame.getHeight()); frame.setVisible(true); }
From source file:Main.java
public static void main(String s[]) { JFrame frame = new JFrame("Slider Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new Main()); frame.pack();//from w ww .j a v a 2 s .co m frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(labels); jlist1.setVisibleRowCount(4);/*w ww .j av a2 s. co m*/ JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); jlist1.setSelectionForeground(Color.RED); frame.setSize(300, 350); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame("ListPanel"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new Main()); f.pack();/*from w ww .j a v a2 s. c o m*/ f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Main"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200);/* w w w. jav a2 s . com*/ frame.setLocation(200, 200); frame.setContentPane(new Main()); frame.setVisible(true); }
From source file:TreeSingleSelection.java
public static void main(String[] argv) { JTree tree = new JTree(); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); JFrame frame = new JFrame("Tree single selection"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(tree)); frame.setSize(380, 320);/*w ww . java 2 s. c o m*/ frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.getContentPane().add(new Main().makeUI()); frame.setSize(320, 240);/*from www. j a v a 2s .c o m*/ frame.setVisible(true); }