List of usage examples for javax.swing JFrame add
public Component add(Component comp)
From source file:Main.java
public static void main(String[] argv) throws Exception { MyComponent component = new MyComponent(); JFrame f = new JFrame(); f.add(component); f.setSize(300, 300);/* w w w .ja v a2 s .c om*/ f.setVisible(true); }
From source file:Main.java
public static void main(String... s) { DefaultTableModel model = new DefaultTableModel(4, 4) { @Override// w w w.j ava 2 s . co m public boolean isCellEditable(int row, int column) { return column == 3; } @Override public Class<?> getColumnClass(int columnIndex) { if (columnIndex == 3) { return Boolean.class; } return super.getColumnClass(columnIndex); } }; JTable t = new JTable(model); JFrame f = new JFrame(); f.add(new JScrollPane(t)); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.add(new Main()); frame.pack();/* w w w . j a v a 2s.c o m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
From source file:InsertAction.java
public static void main(String[] argv) { JTextField component = new JTextField(10); InsertAction insertSpaceAction = new InsertAction(); component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(new Character(' '), 0), "none"); component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("pressed SPACE"), insertSpaceAction.getValue(Action.NAME)); component.getActionMap().put(insertSpaceAction.getValue(Action.NAME), insertSpaceAction); JFrame f = new JFrame(); f.add(component); f.setSize(300, 300);//from w w w .ja v a 2 s .c o m f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) { int rows = 10; int cols = 5; JTable table = new JTable(rows, cols); JFrame f = new JFrame(); f.setSize(300, 300);//from w w w. j a v a 2 s . c o m f.add(new JScrollPane(table)); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Text attributes"); frame.add(new Main()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(620, 190);/* ww w .j av a2 s. c o m*/ frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws InterruptedException { JFrame frame = new JFrame(); frame.add(new JLabel("Minimize demo")); frame.pack();/*from ww w . java 2 s . c om*/ // Show the frame frame.setVisible(true); // Sleep for 5 seconds, then minimize Thread.sleep(5000); frame.setState(Frame.ICONIFIED); // Sleep for 5 seconds, then restore Thread.sleep(5000); frame.setState(Frame.NORMAL); // Sleep for 5 seconds, then kill window Thread.sleep(5000); frame.setVisible(false); frame.dispose(); // Terminate test System.exit(0); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Object[][] cellData = { { "1-1", "1-2" }, { "2-1", "2-2" } }; String[] columnNames = { "col1", "col2" }; JTable table = new JTable(cellData, columnNames); JFrame f = new JFrame(); f.setSize(300, 300);//from ww w . j a v a2 s. co m f.add(new JScrollPane(table)); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Composition"); frame.add(new CompositingDST_ATOP()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 120);/* ww w . ja va2s. c o m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DefaultTableModel model = new DefaultTableModel(); JTable table = new JTable(model); model.addColumn("Col1"); model.addColumn("Col2"); JFrame f = new JFrame(); f.setSize(300, 300);/*from w w w .ja va 2 s .co m*/ f.add(new JScrollPane(table)); f.setVisible(true); }