• 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

JScrollPane and hidden content

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
My JScrollPane works properly with scrollbars etc., but I have a big problem.
When the initial viewPoint is created, everything is ok, but if I scroll down, I would expect to see the hidden contents (I have a long list o JPanels with FlowLayout on Y-Axis) but... nothing is shown!
To view the "new" contents, I have to resize my window... and it's not very smart.
How can I solve this? It doesn't seem to be a particular problem of my PC or my OS because examples (java applets) on the Sun page are ok!

thank you
mic
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michele Palmia wrote:Hi!
My JScrollPane works properly with scrollbars etc., but I have a big problem.
When the initial viewPoint is created, everything is ok, but if I scroll down, I would expect to see the hidden contents (I have a long list o JPanels with FlowLayout on Y-Axis) but... nothing is shown!
To view the "new" contents, I have to resize my window... and it's not very smart.



My guess is that it's a layout issue, and in particular, the layout of the component that is held by the scrollpane's viewport. If it uses FlowLayout, please understand that FlowLayout is not particularily "intelligent" as some of the other layout managers.

For more help, you may wish to create and post a small demo program that we can run and that shows your problem.

Much luck!
 
Michele Palmia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you for the answer!
this is what I've done, hope you can help me!


 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I test ran your code and I don't see the problem you stated. I do see other problems with the code, namely that youare mixing AWT and Swing components in the same GUI. Don't do this. I recommend changing over totally to Swing components.

Then too, the Swing components should be constructed and launched on the EDT. Read this for details:
http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html

I've refactored your code to incorporate my advice, and also shortened it by getting rid of various things not relevant to your problem.

 
Michele Palmia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey!
thank you for the advices and for the code. The problem I described is solved with your new setup!
It was very useful to see a well coded but simple Dialog. thank you!

 
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic