This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 10167
    
    8

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: 10167
    
    8

Please share your full and real code so we can try and figure out what's going wrong
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JList Problem in swings
 
Similar Threads
How to update JList
How to Add Remove item in a jList with a jButton
what does getModel do?
JList null pointer exception
JList selected Elements binding