List of usage examples for javax.swing JList setVisibleRowCount
@BeanProperty(visualUpdate = true, description = "The preferred number of rows to display without requiring scrolling") public void setVisibleRowCount(int visibleRowCount)
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); JList jlist1 = new JList(); jlist1.setListData(labels);//from ww w. j a v a 2 s . c o m jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); ListCellRenderer r = jlist1.getCellRenderer(); 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("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);//from ww w . j a v a 2 s . c om jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); ListModel m = jlist1.getModel(); 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("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);/*from w w w.j a v a2 s .co m*/ jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); Dimension m = jlist1.getPreferredScrollableViewportSize(); 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("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);/* w w w.j a va2 s . co m*/ jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); Rectangle r = jlist1.getCellBounds(0, 1); 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("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);//from w w w .ja v a 2 s. c om jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); ListSelectionListener[] lis = jlist1.getListSelectionListeners(); 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("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);//from w ww.j a va2 s. c om jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); boolean b = jlist1.getDragEnabled(); 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("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList jlist1 = new JList(); jlist1.setListData(labels);//www . j av a 2s . c o m jlist1.setVisibleRowCount(4); JScrollPane scrollPane1 = new JScrollPane(jlist1); frame.add(scrollPane1, BorderLayout.NORTH); int s = jlist1.getFixedCellHeight(); frame.setSize(300, 350); frame.setVisible(true); }
From source file:SizingSamples.java
public static void main(String args[]) { String labels[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }; JFrame frame = new JFrame("Sizing Samples"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); JList jlist1 = new JList(labels); jlist1.setVisibleRowCount(4); DefaultListModel model = new DefaultListModel(); model.ensureCapacity(1000);/* w w w .java 2 s .c om*/ for (int i = 0; i < 100; i++) { for (int j = 0; j < 10; j++) { model.addElement(labels[j]); } } JScrollPane scrollPane1 = new JScrollPane(jlist1); contentPane.add(scrollPane1, BorderLayout.NORTH); JList jlist2 = new JList(model); jlist2.setVisibleRowCount(4); jlist2.setFixedCellHeight(12); jlist2.setFixedCellWidth(200); JScrollPane scrollPane2 = new JScrollPane(jlist2); contentPane.add(scrollPane2, BorderLayout.CENTER); JList jlist3 = new JList(labels); jlist3.setVisibleRowCount(4); contentPane.add(jlist3, BorderLayout.SOUTH); frame.setSize(300, 350); frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { final String labels[] = { "A", "B", "C", "D", "E" }; JFrame frame = new JFrame("Multi-Columns"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList columns = new JList(labels); columns.setLayoutOrientation(JList.HORIZONTAL_WRAP); columns.setVisibleRowCount(3); JScrollPane sp = new JScrollPane(columns); frame.add(sp, BorderLayout.CENTER); frame.setSize(300, 200);// w w w .j ava 2 s . c om frame.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { String[] items = { "A", "B", "C", "D" }; JList list = new JList(items); JScrollPane scrollingList = new JScrollPane(list); // Make the number of rows dynamic list.setVisibleRowCount(0); }