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 f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new Main()); f.pack();/*from www. j a va2 s. c om*/ f.setSize(new Dimension(300, 200)); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new BorderLayout()); f.add(new TestPane()); f.pack();/* ww w. ja va 2s . c o m*/ f.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);/* w w w.j a va2s. c om*/ internalFrame.setBounds(25, 25, 200, 100); JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER); internalFrame.add(label, BorderLayout.CENTER); internalFrame.setVisible(true); DesktopManager desktopManager = desktop.getDesktopManager(); desktopManager.minimizeFrame(internalFrame); frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { String labels[] = { "A", "B", "C", "D", "E", "F", "G", "H" }; JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList<String> jlist = new JList<>(labels); JScrollPane scrollPane1 = new JScrollPane(jlist); f.add(scrollPane1, BorderLayout.CENTER); MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { JList<String> theList = (JList) mouseEvent.getSource(); if (mouseEvent.getClickCount() == 2) { int index = theList.locationToIndex(mouseEvent.getPoint()); if (index >= 0) { Object o = theList.getModel().getElementAt(index); System.out.println("Double-clicked on: " + o.toString()); }//from ww w . j a v a 2 s . c o m } } }; jlist.addMouseListener(mouseListener); f.setSize(350, 200); f.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);//ww w.j av a 2 s . c om JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); jlist1.setSelectedIndices(new int[] { 1, 2 }); frame.setSize(300, 350); frame.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(250, 250);//from ww w . jav a 2 s . c o m frame.setLocation(200, 200); frame.setContentPane(new Main()); frame.setVisible(true); }
From source file:MyCellRenderer.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList list = new JList(new String[] { "A", "B", "C" }); list.setCellRenderer(new MyCellRenderer()); frame.add(new JScrollPane(list)); frame.setSize(300, 200);//from www . j a v a 2 s . c o m frame.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) { Object rows[][] = { { "A", "a" }, { "B", "b" }, { "E", "e" } }; Object headers[] = { "Upper", "Lower" }; JTable table = new JTable(rows, headers); table.setTableHeader(null);/*from w w w. j a v a 2 s . c o m*/ JScrollPane scrollPane = new JScrollPane(table); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 150); 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 w w w.j av 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); DesktopManager desktopManager = desktop.getDesktopManager(); desktopManager.activateFrame(internalFrame); frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Container c1 = new GradientPanel(); Container c2 = new GradientPanel(); JTabbedPane top = new JTabbedPane(); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); top = new JTabbedPane(JTabbedPane.TOP); top.addTab("1", c1); top.addTab("2", c2); frame.add(top);//from w w w . j av a 2s.c o m frame.pack(); frame.setVisible(true); }