Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JScrollPane impossible to add....  RSS feed

 
Rocky Summers
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ranchers!
i'm having difficulty (again) in adding a JScrollPane in my program. In my controller class, i have a frame that has a container, that contains a panel from another class (class a) with all that its contents shown in the screen. when i click a button in class a, in my controller class, it changes the current panel and set it to another class' panel (class b)... is there any way i can add a JScrollPane just in my controller class? or rather, is there any way i can show a scrollbar in every page (when it's needed)...
hope you all understand my question.. please ask if you don't..
thank you,
~ rockster
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can either:
1 - have classes A and B send (their JPanels inside) a JScrollPane, or
2 - remove the old JPanel from the JFrames JScrollPane and add the new JPanel into the JScrollPane (using getViewport().setView(classBPanel)).
 
Rocky Summers
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmmm... sounds like a great idea! i'll try the first option when i get to school tomorrow. thank you
 
Rocky Summers
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi craig..
i tried those two options it still wouldn't add..
 
Rocky Summers
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think this is the problem.. but i can't figure out a way to resolve this...
in my class_a, i have this code:
p.setLayout(null);
if i take out that code, everything looks screwed up... i'm using that code because the layout i'm using is absolute layout...... that means, i'm specifying each component's coordinate and size...
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!