Example usage for javax.swing JList getPrototypeCellValue

List of usage examples for javax.swing JList getPrototypeCellValue

Introduction

In this page you can find the example usage for javax.swing JList getPrototypeCellValue.

Prototype

public E getPrototypeCellValue() 

Source Link

Document

Returns the "prototypical" cell value -- a value used to calculate a fixed width and height for cells.

Usage

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 ww  .j  ava2  s. c om*/

    jlist1.setVisibleRowCount(4);
    JScrollPane scrollPane1 = new JScrollPane(jlist1);
    frame.add(scrollPane1, BorderLayout.NORTH);

    Object o = jlist1.getPrototypeCellValue();

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