• 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

Scrollbar not Working

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I have a typical Issue. I have a JPanel on a JScrollPane now I have a custom Class iwhich extends a JPanel. In this Class I have a Two JButtons , One JTextField and Two JLabels.
Among them one button creates a New instance for that class only.

Basically I am trying to add that same Panel (with those Components ) by clicking on a JButton Click but the problem is that the Scrollbar is not coming but the JPanels are being added.
Can anyone please help me on this.
 
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
To get better help sooner, post a SSCCE that clearly demonstrates your problem.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From experience I've learned that you also need to revalidate() the JScrollPane when the size of its contents may have changed.
 
Rohit Kedia
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am doing that but the Issue is something Different , everytime I am adding a new Panel to another Parent Panel which is within a ScrollPane, I am facing a peculiar Issue.
I am using here a GridLayout with 0 rows & 2 columns , now if I increase the VGap for the Layout to say 50 then the Scrollbar is coming Fast say after adding 10 Panels.
For this Issue I tried to increase the size of the JPanel by 50 on every two child Panels addition the size of the Panel is increasing but all my child JPanels are getting squeezed in that Panel only after adding say 10 more all the child Panels are getting squeezed to 0 visiblity
basically they are adjusting themselves within that JPanel despite I am increasing the size of the JPanel which is within a ScrollPane.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am doing that but the Issue is something Different



And I don't see a SSCCE anywhere, so I guess we will never solve the problem.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic