I'm new to Swing and like the subject says am haivng problems getting my Jlist to scroll. I know that JList does not scroll natively (why does the JList icon have a scroll bar on it then) and that I need to make an instance of a JScrollPane, or do i ?
I tried the scroll bar component w/ no luck.
This is my code:
- Code: Select all
...
myList = new JList();
myList.setBounds(13, 24, 250, 280);
panel_1.add(myList);
panel_1.add(new JScrollPane(myList));
listPid.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
...
This doesnt show any object in the position that the JList should be in,
I know i am missing somthing obvious here, but does anyone have any advice ?
Thanks,
James