• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

jscrollpane wont show until i adjust window size with mouse???  RSS feed

 
Ranch Hand
Posts: 43
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so for a test i have a small array set as a jlist which is the contents of my jscrollpane, and it appears as if nothing is there until i adjust the window size by dragging it out or in... whats going on?
here is the full code
 
Sheriff
Posts: 23714
50
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that's because you called "setVisible(true)" too early in the setup process. After you call it (at line 37 in your posted code) you go on to modify the UI by adding more components. Usually when you add more components to a GUI which is already visible you have to do something to adjust the GUI to account for them. But in this case I'd say it's sufficient to move the call to setVisible down to the end of the constructor.
 
Kip Bodey
Ranch Hand
Posts: 43
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you... you're the man i didn't even think about that
 
Marshal
Posts: 60916
190
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shall move this discussion to our GUIs forum. I shall also amend that long comment which makes the page hard to read.

Agree with PC. Always call setVisible last. Otherwise you would have to call revalidate() or similar on your Frame. There is a section about scroll panes in the Java Tutorials.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!