List of usage examples for java.awt BorderLayout CENTER
String CENTER
To view the source code for java.awt BorderLayout CENTER.
Click Source Link
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Properties props = System.getProperties(); JTree tree = new JTree(props); JComboBox comboBox = new JComboBox(new String[] { "A", "B", "C" }); TreeCellEditor editor = new DefaultCellEditor(comboBox); tree.setEditable(true);/*from w w w.ja v a 2 s. com*/ tree.setCellEditor(editor); JScrollPane scrollPane = new JScrollPane(tree); frame.add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 150); frame.setVisible(true); }
From source file:TreeLines.java
public static void main(String args[]) { JFrame frame = new JFrame("Tree Lines"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container content = frame.getContentPane(); Box box = Box.createHorizontalBox(); JTree tree1 = new JTree(); tree1.putClientProperty("JTree.lineStyle", "Angled"); JScrollPane scrollPane1 = new JScrollPane(tree1); tree1.setAutoscrolls(true);//w w w . j a va 2 s . c o m JTree tree2 = new JTree(); JScrollPane scrollPane2 = new JScrollPane(tree2); box.add(scrollPane1, BorderLayout.WEST); box.add(scrollPane2, BorderLayout.EAST); frame.getContentPane().add(box, BorderLayout.CENTER); frame.setSize(300, 240); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) { JFrame frame = new JFrame("Swing Package Hierarchy"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Vector rootVector = new TreeVector("A", new String[] { "a" }); JTree tree = new JTree(rootVector); tree.setRootVisible(true);//from w ww . jav a2s. c om TreeModel model = tree.getModel(); model.valueForPathChanged(new TreePath(model.getRoot()), "javax.swing"); ((DefaultTreeModel) model).reload(); JScrollPane scrollPane = new JScrollPane(tree); frame.getContentPane().add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 300); frame.setVisible(true); }
From source file:SpinnerStringsSample.java
public static void main(String args[]) { JFrame frame = new JFrame("JSpinner Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); DateFormatSymbols symbols = new DateFormatSymbols(Locale.FRENCH); String days[] = symbols.getWeekdays(); SpinnerModel model1 = new SpinnerListModel(days); JSpinner spinner1 = new JSpinner(model1); JLabel label1 = new JLabel("French Days/List"); JPanel panel1 = new JPanel(new BorderLayout()); panel1.add(label1, BorderLayout.WEST); panel1.add(spinner1, BorderLayout.CENTER); frame.add(panel1, BorderLayout.NORTH); frame.setSize(200, 90);/*from w ww . j a va 2s . co m*/ frame.setVisible(true); }
From source file:LazySample.java
public static void main(String args[]) { JFrame frame = new JFrame("Lazy Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Integer fifteen = new Integer(15); Object lazyArgs[] = new Object[] { Color.GREEN, Boolean.TRUE, fifteen, fifteen }; Object lazyDiamond = new UIDefaults.ProxyLazyValue("MyIcon", lazyArgs); UIManager.put("Tree.openIcon", lazyDiamond); JTree tree = new JTree(); JScrollPane scrollPane = new JScrollPane(tree); frame.add(scrollPane, BorderLayout.CENTER); frame.setSize(200, 200);// ww w. j ava 2 s . c o m frame.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(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); DefaultListModel model = new DefaultListModel(); model.ensureCapacity(1000);/*from w ww. j a v a 2 s . co m*/ for (int j = 0; j < 5; j++) { model.addElement(labels[j]); } System.out.println(model.toString()); JList jlist2 = new JList(model); jlist2.setVisibleRowCount(4); jlist2.setFixedCellHeight(12); jlist2.setFixedCellWidth(200); JScrollPane scrollPane2 = new JScrollPane(jlist2); frame.add(scrollPane2, BorderLayout.CENTER); frame.setSize(300, 350); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame("Test"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(createLogin(), BorderLayout.CENTER); JLabel admonition = new JLabel("CopyRight java2s.com.", JLabel.CENTER); f.add(admonition, BorderLayout.SOUTH); f.pack();/*ww w . j a va 2 s .c o m*/ f.setVisible(true); }
From source file:HeaderlessSample.java
public static void main(String args[]) { Object rowData[][] = { { "Row1-Column1", "Row1-Column2", "Row1-Column3" }, { "Row2-Column1", "Row2-Column2", "Row2-Column3" } }; Object columnNames[] = { "Column 1", "Column 2", "Column 3" }; // JTable table = new HeaderlessTable(rowData, columnNames); JTable table = new JTable(rowData, columnNames); table.setTableHeader(null);// www . ja v a 2 s. co m JScrollPane scrollPane = new JScrollPane(table); // scrollPane.setColumnHeaderView(null); JFrame frame = new JFrame("Headerless Table"); frame.getContentPane().add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 150); frame.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); DefaultListModel model = new DefaultListModel(); model.ensureCapacity(1000);/*from w w w. j a v a 2s . c o m*/ for (int i = 0; i < 100; i++) { for (int j = 0; j < 5; j++) { model.addElement(labels[j]); } } JList jlist2 = new JList(model); jlist2.setVisibleRowCount(4); jlist2.setFixedCellHeight(12); jlist2.setFixedCellWidth(200); JScrollPane scrollPane2 = new JScrollPane(jlist2); frame.add(scrollPane2, BorderLayout.CENTER); frame.setSize(300, 350); frame.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(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); DefaultListModel model = new DefaultListModel(); model.ensureCapacity(1000);/*www. java 2s . com*/ for (int j = 0; j < 5; j++) { model.addElement(labels[j]); } System.out.println(model.toArray().length); JList jlist2 = new JList(model); jlist2.setVisibleRowCount(4); jlist2.setFixedCellHeight(12); jlist2.setFixedCellWidth(200); JScrollPane scrollPane2 = new JScrollPane(jlist2); frame.add(scrollPane2, BorderLayout.CENTER); frame.setSize(300, 350); frame.setVisible(true); }