List of usage examples for javax.swing JFrame setVisible
public void setVisible(boolean b)
From source file:Main.java
public static void main(String s[]) { Main example = new Main(); JFrame frame = new JFrame("Menu Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setJMenuBar(example.menuBar);/*www.j a va 2 s . co m*/ frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { String imageFile = "A.jpg"; RepaintManager.currentManager(null).setDoubleBufferingEnabled(false); Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getResource(imageFile)); image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_SMOOTH); JFrame frame = new JFrame("DragImage"); frame.getContentPane().add(new Main(image)); frame.setSize(300, 300);/* w ww . ja v a 2 s . c o m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { String imageFile = "A.jpg"; RepaintManager.currentManager(null).setDoubleBufferingEnabled(false); Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getResource(imageFile)); image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_DEFAULT); JFrame frame = new JFrame("DragImage"); frame.getContentPane().add(new Main(image)); frame.setSize(300, 300);/* ww w. j a v a2s . c o m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { String imageFile = "A.jpg"; RepaintManager.currentManager(null).setDoubleBufferingEnabled(false); Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getResource(imageFile)); image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_FAST); JFrame frame = new JFrame("DragImage"); frame.getContentPane().add(new Main(image)); frame.setSize(300, 300);/*from w w w .j a va 2 s .co m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new Main()); frame.pack();//from w ww . j a v a2s . c om frame.setVisible(true); }
From source file:TextTransferTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new TextTransferFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }//from www . ja va 2 s . c o m }); }
From source file:Main.java
public static void main(String[] args) { String imageFile = "A.jpg"; RepaintManager.currentManager(null).setDoubleBufferingEnabled(false); Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getResource(imageFile)); image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_AREA_AVERAGING); JFrame frame = new JFrame("DragImage"); frame.getContentPane().add(new Main(image)); frame.setSize(300, 300);/*from w ww .j a v a 2s.c o m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { DefaultTableModel model;//from ww w .j av a 2s. c om JTable t = new JTable(model = new DefaultTableModel(0, 1)); for (int i = 0; i < 10; i++) { model.addRow(new Object[] { i }); } JButton removeSelected = new JButton("remove"); removeSelected.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int[] selectedRows = t.getSelectedRows(); for (int i = selectedRows.length - 1; i >= 0; i--) { model.removeRow(selectedRows[i]); ; } } }); JFrame f = new JFrame(); f.add(new JScrollPane(t)); f.add(removeSelected, BorderLayout.SOUTH); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { NumberFormat numberFormatGuFalse = NumberFormat.getNumberInstance(); numberFormatGuFalse.setGroupingUsed(false); JFormattedTextField jftFieldGuFalse = new JFormattedTextField(numberFormatGuFalse); NumberFormat numberFormatGuTrue = NumberFormat.getNumberInstance(); // numberFormatGuFalse.setGroupingUsed(true); // not necessary as is default JFormattedTextField jftFieldGuTrue = new JFormattedTextField(numberFormatGuTrue); JPanel panel = new JPanel(new BorderLayout()); panel.add(jftFieldGuFalse, BorderLayout.NORTH); panel.add(jftFieldGuTrue, BorderLayout.SOUTH); JFrame frame = new JFrame(); frame.getContentPane().add(panel);/* ww w. j a va 2 s. c om*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }