• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applet componets not showing

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, I build an Applet with text areas, button JcomboBoxes, etc. I put all these components in a JPanel called jPanel1. At the end I pop the panel on the container and everything worked great until I decided to have a selection from a JComboBox place one component, a JTable, on the panel.(Before I was just placing it directly on there without user input). It appears to remove the old component (a JScrollPane) but the table never shows. What do I need to do?
see code snippets below
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not wish to seem ungrateful, I appreciate someone taking the time to answer.
Thank you Craig but�
I do not think the answer provided can be used in this case. The reason is that the tables (2 of them) have 10 columns and ,in worse case, 6000 rows (on average just around 1000) This would mean possibly storing 120,000 JTables. Even if the clients machine could handle this I don�t think it would be the best approach. I should have given more details when I first posted. My apologies.
I am implementing the code found on Sun�s web-site:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
It seems to work great after modifying it to take the data from a database based on user selection in the applet. I just can�t seem to get it to appear in the beginning. If I build all my components from the start and populate the table with a hard coded selection so that when the entire container is started it knows to place a table at a certain location then everything works great. I can sort and re-sort. If I draw everything from the beginning except the table and wait on the user to put in the parameters for the table then�.not so good It seems to remove the component that I put in as a place holder for the table (a JscrollPane) but the table never appears.
Again, Thank you Craig for your input but if you, are someone else, could re-examine the issue with this new information I would appreciate it.

If I draw everything from the beginning except the table and wait on the user to put in the parameters for the table then�.not so good
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Update...disregard and thanks for the help. In backtracking to get back to the original code I fixed it so it does what I need it to now.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you add a component to a container after that container is physically visible on the screen, then you must call validate() on that container to force it to be laid out again, or the new component won't show up. Perhaps that's the problem you're having?
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ernest,
you are a saint. After I thought I had fixed it I realized that it still wasn't working correctly. I was embarrassed to come back and admit it but then I saw your post. That seems to be the problem. Thanks for the tip on validate. I was using repaint and not getting anywhere.
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm, the table shows in a scrollPane but I can't use the scrollPane. Anythoughts on why or what would cause it?
reply
    Bookmark Topic Watch Topic
  • New Topic