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(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 . j a v a2 s . co m*/ for (int i = 0; i < 100; i++) { for (int j = 0; j < 5; j++) { model.addElement(labels[j]); } } model.removeElement("A"); 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);// w w w. ja v a 2 s . c om for (int i = 0; i < 100; i++) { for (int j = 0; j < 5; j++) { model.addElement(labels[j]); } } model.removeElementAt(0); 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:MainClass.java
public static void main(String args[]) { JFrame frame = new JFrame("Lazy Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Object iconObject = LookAndFeel.makeIcon(MainClass.class, "yourImage.gif"); UIManager.put("Tree.leafIcon", iconObject); Integer fifteen = new Integer(15); Object lazyArgs[] = new Object[] { Color.GREEN, Boolean.TRUE, fifteen, fifteen }; Object lazyDiamond = new UIDefaults.ProxyLazyValue("DiamondIcon", lazyArgs); UIManager.put("Tree.openIcon", lazyDiamond); JTree tree = new JTree(); JScrollPane scrollPane = new JScrollPane(tree); frame.add(scrollPane, BorderLayout.CENTER); frame.setSize(200, 200);/* w w w . j a va 2s. 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);//ww w .j av a 2 s. c om for (int i = 0; i < 100; i++) { for (int j = 0; j < 5; j++) { model.addElement(labels[j]); } } model.removeAllElements(); 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);/*from w w w . j av a2 s .c o m*/ for (int i = 0; i < 100; i++) { for (int j = 0; j < 5; j++) { model.addElement(labels[j]); } } model.ensureCapacity(100); 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);// ww w . j a va 2 s . co m for (int i = 0; i < 100; i++) { for (int j = 0; j < 5; j++) { model.addElement(labels[j]); } } model.setElementAt("0", 0); 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:MainClass.java
public static void main(String args[]) throws Exception { Object elements[][] = { { new Font("Courier", Font.BOLD, 16), Color.YELLOW, "This" }, { new Font("Helvetica", Font.ITALIC, 8), Color.DARK_GRAY, "Computer" } }; JFrame frame = new JFrame("Complex Renderer"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist = new JList(elements); ListCellRenderer renderer = new ComplexCellRenderer(); jlist.setCellRenderer(renderer);/*from ww w . j a v a 2s . co m*/ JScrollPane scrollPane = new JScrollPane(jlist); frame.add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 200); 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 w w. j a va2 s .c o m for (int i = 0; i < 100; i++) { for (int j = 0; j < 5; j++) { model.addElement(labels[j]); } } model.insertElementAt("0", 0); 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);/*from w w w .j av a 2 s .c o m*/ for (int i = 0; i < 100; i++) { for (int j = 0; j < 5; j++) { model.addElement(labels[j]); } } System.out.println(model.get(1)); 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);/*from ww w. j a va 2 s .c o m*/ for (int i = 0; i < 100; i++) { for (int j = 0; j < 5; j++) { model.addElement(labels[j]); } } System.out.println(model.size()); 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); }