File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JList Problem in swings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JList Problem in swings" Watch "JList Problem in swings" New topic
Author

JList Problem in swings

siva chaitanya
Ranch Hand

Joined: Jul 05, 2011
Posts: 59
Can't able to add elements in JList. I have taken DefaultListModel and JList to add elements but i can't able to make it. This is the code.

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

You added the JList to the JScrollPane. What is the parent container for JScrollPane? Did you add it to anything?
When you run this code, do you even see the JFrame? I do not see any code which will set it's dimensions nor any pack call. Is this your real code?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
siva chaitanya
Ranch Hand

Joined: Jul 05, 2011
Posts: 59
Ya i have seen the frame and also the JList but i can't see the elements in the jlist
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Please share your full and real code so we can try and figure out what's going wrong
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JList Problem in swings
 
Similar Threads
JList null pointer exception
JList selected Elements binding
How to update JList
what does getModel do?
How to Add Remove item in a jList with a jButton