JList: setVisibleRowCount(int count) : JList « javax.swing « Java by API






JList: setVisibleRowCount(int count)

  
import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JScrollPane;

public class MainClass {

  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(labels);
    jlist1.setVisibleRowCount(4);
    JScrollPane scrollPane1 = new JScrollPane(jlist1);
    frame.add(scrollPane1, BorderLayout.NORTH);

  
    frame.setSize(300, 350);
    frame.setVisible(true);
  }
}
           
         
    
  








Related examples in the same category

1.JList.VERTICAL_WRAP
2.new JList(Object[] listData)
3.new JList(Vector listData)
4.new JList(ListModel dataModel) (Share model with JComboBox)
5.new JScrollPane(JList list)
6.JList: addListSelectionListener(ListSelectionListener listener)
7.JList: addMouseListener(MouseListener lis)
8.JList: addSelectionInterval(int anchor, int lead)
9.JList: clearSelection()
10.JList: getFirstVisibleIndex()
11.JList: getLastVisibleIndex()
12.JList: getLayoutOrientation()
13.JList: getMaxSelectionIndex()
14.JList: getNextMatch(String prefix, int startIndex, Bias bias)
15.JList: getSelectedIndices()
16.JList: getSelectedValues()
17.JList.getSelectionBackground()
18.JList: getSelectionForeground()
19.JList: getVisibleRowCount()
20.JList: isSelectedIndex(int index)
21.JList: isSelectionEmpty()
22.JList: locationToIndex(Point p)
23.JList: removeSelectionInterval(int index0, int index1)
24.JList: setCellRenderer(ListCellRenderer cellRenderer)
25.JList: setDragEnabled(boolean b)
26.JList: setFixedCellHeight(int height)
27.JList: setFixedCellWidth(int width)
28.JList: setLayoutOrientation(int ori)
29.JList: setModel(ListModel model)
30.JList: setPrototypeCellValue(Object prototypeCellValue)
31.JList: setSelectedIndex(int index)
32.JList: setSelectedValue(Object anObject, boolean shouldScroll)
33.JList: setSelectionInterval(int anchor, int lead)
34.JList: setSelectionMode(int selectionMode)
35.extends JList (custom tooltops)