dimanche 8 mars 2015

Issue With Java JList


Vote count:

0




I have tried to use a Jlist but I have not been able to get it to show up in my JFrame.


Here is my code: private static void list(){ JFrame frame = new JFrame(); frame.setTitle("Menu"); frame.setSize(500, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setLayout(new FlowLayout()); listModel = new DefaultListModel(); listModel.addElement("Add Member"); listModel.addElement("Add Meeting"); listModel.addElement("Record Attendance");



list = new JList(listModel);
list.setVisibleRowCount(3);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setSelectedIndex(0);
JScrollPane listScrollPane = new JScrollPane(list);
frame.add(listScrollPane, BorderLayout.CENTER);


Currently when I run the program the frame will open, but it is blank. Any help?



asked 27 secs ago







Issue With Java JList

Aucun commentaire:

Enregistrer un commentaire