Results 1 to 2 of 2
Thread: Collection to JList to Display
- 12-03-2010, 12:48 PM #1
Member
- Join Date
- Nov 2010
- Posts
- 11
- Rep Power
- 0
Collection to JList to Display
Just wondering why when i use this which should correctly get a collection turn it to array then let me turn it into a JList and display it. why it lets me compile it fine but just displays a empty box. does this if i use either the dept or entry array in the JList
any Help appreciatedJava Code:Collection<Department> d = Department.getCollection(); dept = new Department[d.size()]; String[] entry = new String[dept.length]; for (Iterator<Department> iter = d.iterator(); iter. hasNext(); ) for (int k=0; k<dept.length; k++) { dept[k] = iter.next(); entry[k] = dept[k].getName(); } JList deptList = new JList(dept); deptList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); panel.add(deptList); JScrollPane deptListscroll = new JScrollPane(deptList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); panel.add(deptListscroll);Last edited by D.Calladine; 12-03-2010 at 01:27 PM.
- 12-03-2010, 12:53 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Similar Threads
-
Display only certain contents of text file and edit display
By blkshrk81 in forum New To JavaReplies: 1Last Post: 12-01-2010, 06:35 PM -
What is the different between Text format display on web browser and display on midle
By Basit781 in forum CLDC and MIDPReplies: 1Last Post: 05-31-2010, 08:46 AM -
[SOLVED] JList( Vector ) Display problem
By logicbug in forum AWT / SwingReplies: 4Last Post: 03-21-2009, 02:28 PM -
How to display a list of items and on click display subitems?
By mandyj in forum New To JavaReplies: 8Last Post: 12-29-2008, 07:12 AM -
How do I display a JList with icons and text?
By aneesahamedaa in forum AWT / SwingReplies: 2Last Post: 09-04-2008, 08:49 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks