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) { final JTextPane tp = new JTextPane(); JButton withFocus = new JButton("Select with focus"); withFocus.addActionListener(e -> { tp.selectAll();/*from www. java2 s . c o m*/ tp.requestFocus(); }); JButton withOutFocus = new JButton("Select without focus"); withFocus.addActionListener(e -> tp.selectAll()); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new JScrollPane(tp)); JPanel panel = new JPanel(); panel.add(withFocus); panel.add(withOutFocus); frame.add(panel, BorderLayout.SOUTH); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("First Name"); label.setForeground(Color.DARK_GRAY); JFrame frame = new JFrame(); frame.add(label);/*from w w w.ja v a2s . c o m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("Modifying Model"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist = new JList(new String[] { "A", "B", "C" }); jlist.setSelectedIndex(0);//from w ww. j a v a2s.c o m JScrollPane scrollPane1 = new JScrollPane(jlist); frame.add(scrollPane1, BorderLayout.CENTER); frame.setSize(640, 300); frame.setVisible(true); }
From source file:Main.java
public static void main(final String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDesktopPane desktop = new JDesktopPane(); JInternalFrame internalFrame = new JInternalFrame("Can Do All", true, true, true, true); desktop.add(internalFrame);//from www . j a v a 2 s .co m internalFrame.setBounds(25, 25, 200, 100); JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER); internalFrame.add(label, BorderLayout.CENTER); internalFrame.setVisible(true); desktop.getDesktopManager().maximizeFrame(internalFrame); frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("First Name"); label.setForeground(Color.WHITE); JFrame frame = new JFrame(); frame.add(label);/* w w w. java2 s . c o m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String... args) { JTextPane tPane = new JTextPane(); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); appendToPane(tPane, "this is a test.\n", Color.RED, Color.WHITE); appendToPane(tPane, "this is a test \n", Color.PINK, Color.BLUE); appendToPane(tPane, "test", Color.GRAY, Color.BLACK); appendToPane(tPane, "test", Color.RED, Color.BLUE); appendToPane(tPane, "test", Color.RED, Color.YELLOW); f.getContentPane().add(tPane);/*from w w w. j a va 2s . c o m*/ f.pack(); f.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) { JFrame f = new JFrame("JSpinner Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); DateFormatSymbols symbols = new DateFormatSymbols(Locale.FRENCH); String days[] = symbols.getWeekdays(); SpinnerModel model1 = new SpinnerListModel(days); SpinnerModel model2 = new SpinnerDateModel(); JSpinner spinner1 = new JSpinner(model1); JSpinner spinner2 = new JSpinner(model2); f.add(spinner1, BorderLayout.NORTH); f.add(spinner2, BorderLayout.SOUTH); f.setSize(300, 100);// www. j av a 2 s . c o m f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("First Name"); label.setForeground(Color.white); JFrame frame = new JFrame(); frame.add(label);//from w w w .ja v a 2 s.c o m frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("First Name"); label.setForeground(Color.blue); JFrame frame = new JFrame(); frame.add(label);/*from ww w. j a va 2s . c o m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:MatteBorderSample.java
public static void main(String args[]) { JFrame frame = new JFrame("Sample Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Icon diamondIcon = new ImageIcon("yourImage.gif"); Border matteBorder = new MatteBorder(5, 10, 5, 10, diamondIcon); JLabel aLabel = new JLabel("Bevel"); aLabel.setBorder(matteBorder);/* w w w. j a v a2 s.c om*/ aLabel.setHorizontalAlignment(JLabel.CENTER); frame.add(aLabel); frame.setSize(400, 200); frame.setVisible(true); }