• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scrollbar not Working

 
Rohit Kedia
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • 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.
 
Darryl Burke
Bartender
Posts: 5152
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get better help sooner, post a SSCCE that clearly demonstrates your problem.
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!