List of usage examples for javax.swing JFrame add
public Component add(Component comp)
From source file:RigidArea.java
public static void main(String[] args) { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setBorder(new EmptyBorder(new Insets(40, 60, 40, 60))); panel.add(new JButton("Button")); panel.add(Box.createRigidArea(new Dimension(0, 5))); panel.add(new JButton("Button")); panel.add(Box.createRigidArea(new Dimension(0, 5))); panel.add(new JButton("Button")); panel.add(Box.createRigidArea(new Dimension(0, 5))); panel.add(new JButton("Button")); JFrame f = new JFrame(); f.add(panel); f.pack();/*from w w w. j a v a2 s . c o m*/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:Center.java
License:asdf
public static void main(String[] a) { JFrame f = new JFrame(); f.add(new Center()); f.setSize(300, 300);/*www .jav a 2s.c o m*/ f.setVisible(true); }
From source file:RowNumberHeader.java
public static void main(String[] a) { JFrame f = new JFrame(); f.add(new RowNumberHeader(new JTable(3, 4))); f.setSize(300, 300);//w ww . ja v a 2 s. c o m f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Object[][] rowData = {};//w w w. j a v a 2 s . c o m 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[] args) { JFrame frame = new JFrame(); frame.add(new Main()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack();/*from w w w . j a va 2s.co m*/ frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] a) { JFrame f = new JFrame(); f.setSize(400, 400);/* www . ja v a 2 s.c o m*/ f.add(new MainClass()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame f = new JFrame(); f.setSize(400, 400);//from w ww . j a va2s . c om f.add(new Main()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }
From source file:GraphicsDrawChars.java
public static void main(String[] a) { JFrame f = new JFrame(); f.setSize(400, 400);// ww w .j a v a 2 s. c o m f.add(new GraphicsDrawChars()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }
From source file:metrics.java
License:asdf
public static void main(String[] args) { JFrame f = new JFrame(); f.add(new metrics()); f.setSize(300, 300);/*from w w w . java 2 s. c o m*/ f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JPanel panel = new JPanel(); panel.setPreferredSize(new Dimension(800, 600)); String test[] = { "alpha", "bravo", "charlie", "delta", "echo", "omega", "zeta" }; JList<String> list = new JList<>(test); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setLayoutOrientation(JList.VERTICAL); list.setVisibleRowCount(5);/*from ww w .ja va2 s . c o m*/ list.setBounds(50, 150, 75, 90); JScrollPane jScrollPane1 = new JScrollPane(); jScrollPane1.setViewportView(list); panel.add(jScrollPane1); JFrame f = new JFrame(); f.add(panel); f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setResizable(false); f.setFocusable(true); }