List of usage examples for javax.swing WindowConstants EXIT_ON_CLOSE
int EXIT_ON_CLOSE
To view the source code for javax.swing WindowConstants EXIT_ON_CLOSE.
Click Source Link
From source file:Main.java
public static void main(String... args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); Container pane = frame.getContentPane(); pane.add(blackJTextPane());//from w w w . ja va 2 s . c om frame.setSize(800, 600); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JTextArea textArea = new JTextArea(); JFrame f = new JFrame(); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); DefaultCaret caret = new DefaultCaret() { @Override/*from ww w .j av a 2 s. co m*/ public boolean isSelectionVisible() { return true; } }; textArea.setCaret(caret); textArea.setFont(new java.awt.Font("Miriam Fixed", 0, 13)); Color color = Color.BLUE; // textArea.setBackground(color); textArea.setSelectedTextColor(color); f.getContentPane().add(new JScrollPane(textArea)); f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame jFrame = new JFrame(); jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); jFrame.setSize(400, 300);/*from w w w.j ava 2s .c om*/ JPanel panel = new JPanel(new FlowLayout()); jFrame.setContentPane(panel); JEditorPane editor = new JEditorPane(); new Main().remove_border(editor); panel.add(editor); jFrame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.getContentPane().add(new TabView()); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setMinimumSize(new Dimension(800, 450)); frame.pack();/* w ww . ja v a2 s . c o m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) throws Exception { final JFrame frame = new JFrame(); frame.setUndecorated(true);//from w w w . java2s . c om JButton button = new JButton("Minimize"); button.addActionListener(e -> frame.setState(Frame.ICONIFIED)); frame.add(button); frame.pack(); frame.setVisible(true); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.add(new JScrollPane(new Main())); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setVisible(true);//from w w w .j ava2 s .com }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Test"); JPanel panel = new JPanel(); JLabel label = new JLabel("CenteredJLabel"); panel.setLayout(new GridBagLayout()); panel.add(label);/* w w w . ja va 2s . c om*/ panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(panel); frame.setSize(400, 300); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { String HTMLTEXT = "<html><head><style>.foot{color:red} .head{color:black}</style></head>" + "<span style='font-family:consolas'>java2s.com</span><br/>" + "<span style='font-family:tahoma'>java2s.com</span>"; JTextPane textPane1 = new JTextPane(); textPane1.setContentType("text/html"); textPane1.setText(HTMLTEXT);/*from ww w .j av a2s . c o m*/ JFrame f = new JFrame(); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.getContentPane().add(new JScrollPane(textPane1)); f.setSize(320, 240); f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JFrame f = new JFrame(); f.setBackground(new Color(0, true)); // 1.7.0 f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.getContentPane().add(makeUI());/* w w w. j av a 2 s . co m*/ f.setSize(320, 240); f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { final JFrame frame = new JFrame("Test"); KeyboardFocusManager.getCurrentKeyboardFocusManager().addVetoableChangeListener("focusedWindow", new VetoableChangeListener() { private boolean gained = false; @Override//from w w w. j a v a 2 s. c o m public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { if (evt.getNewValue() == frame) { gained = true; } if (gained && evt.getNewValue() != frame) { frame.dispose(); } } }); frame.add(new JTextField(10), BorderLayout.NORTH); frame.add(new JTextField(10), BorderLayout.SOUTH); frame.pack(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setVisible(true); }