File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JList Problem in swings

 
siva chaitanya
Ranch Hand
Posts: 59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
siva chaitanya
Ranch Hand
Posts: 59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya i have seen the frame and also the JList but i can't see the elements in the jlist
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic