List of usage examples for javax.swing JFrame setVisible
public void setVisible(boolean b)
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);/* w w w .j ava 2 s. co m*/ f.add(new JScrollPane(table)); f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTextField component = new JTextField(); component.addMouseListener(new MyMouseListener()); JFrame f = new JFrame(); f.add(component);// ww w .jav a 2s . c o m f.setSize(300, 300); f.setVisible(true); component.addMouseListener(new MyMouseListener()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root Label"); root.add(new DefaultMutableTreeNode("Node Label")); JTree tree = new JTree(root); JFrame f = new JFrame(); f.add(new JScrollPane(tree)); f.setSize(300, 300);/*from w ww . ja v a 2 s . co m*/ f.setVisible(true); }
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 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[] argv) throws Exception { JTree tree = new JTree(); JFrame f = new JFrame(); f.add(new JScrollPane(tree)); f.setSize(300, 300);//from w w w. j a v a 2 s . co m f.setVisible(true); // Get paths of all selected nodes TreePath[] paths = tree.getSelectionPaths(); }
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 .j a v a 2s .c om*/ f.add(new JScrollPane(table)); f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTextField component = new JTextField(); component.addMouseListener(new MyMouseListener()); JFrame f = new JFrame(); f.add(component);/* w ww .j a v a 2s. co m*/ f.setSize(300, 300); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Object[][] rowData = {};/*from w w w. ja va2s . c om*/ Object[] columnNames = { "Column 1", "Column 2", "Column 3" }; DefaultTableModel listTableModel; listTableModel = new DefaultTableModel(rowData, columnNames); for (int i = 1; i < 25; i++) { String rowString = "Quiz #" + i; listTableModel.addRow(new Object[] { rowString, "ICON", "ICON" }); } JTable listTable; listTable = new JTable(listTableModel); listTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); listTable.setCellEditor(null); listTable.setBounds(37, 143, 397, 183); JFrame frame = new JFrame(); frame.add(new JScrollPane(listTable)); frame.setVisible(true); frame.pack(); }
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"); // Create the first row model.insertRow(0, new Object[] { "r1" }); JFrame f = new JFrame(); f.setSize(300, 300);/*from w ww . j ava2 s. com*/ f.add(new JScrollPane(table)); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { File file = new File(args[0]); sun.awt.shell.ShellFolder sf = sun.awt.shell.ShellFolder.getShellFolder(file); Icon icon = new ImageIcon(sf.getIcon(true)); System.out.println("type = " + sf.getFolderType()); JLabel label = new JLabel(icon); JFrame frame = new JFrame(); frame.getContentPane().add(label);/*from w w w .j a v a 2 s. c o m*/ frame.pack(); frame.setVisible(true); }