FileDocCategorySizeDatePackage
ListExample.javaAPI DocExample3493Thu Oct 24 20:14:22 BST 2002None

ListExample

public class ListExample extends JPanel

Fields Summary
private BookEntry[]
books
private JList
booklist
Constructors Summary
public ListExample()


      
        setLayout(new BorderLayout());
        JButton button = new JButton("Print");
        button.addActionListener(new PrintListener());

        booklist = new JList(books);
        booklist.setCellRenderer(new BookCellRenderer());
        booklist.setVisibleRowCount(4);
        JScrollPane pane = new JScrollPane(booklist);

        add(pane, BorderLayout.NORTH);
        add(button, BorderLayout.SOUTH);
    
Methods Summary
public static voidmain(java.lang.String[] s)

         JFrame frame = new JFrame("List Example");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.setContentPane(new ListExample());
         frame.pack();
         frame.setVisible(true);