?
Solved

ScrollPane redraw question.

Posted on 1999-07-28
5
Medium Priority
?
256 Views
Last Modified: 2012-08-14
Hello!

I have panel added to scrollPane (with AS_NEEDED policy).

When I change panel's size (panel.setSize(w,h)) how should I redraw the scrollPane in order to enable scrolling for new panel size?

scrollPane.repaint() doesn't work. Do I miss smth?

Thank you in advance.
0
Comment
Question by:levg
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:masato
ID: 1247261
What did you add to the ScrollPane? Canvas?

ScrollPane panel = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
panel.add(???????);
panel.setSize(w, h);

0
 

Author Comment

by:levg
ID: 1247262
ScrollPane scrollPane = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
Panel panel = new Panel();
panel.setSize(w,h);
scrollPane.add(panel);
It works.

Later in the program:
panel.setSize(newW,newH);
scrolls don't change!
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1247263
panel.invalidate();
scrollPane.validate();
scrollPane.doLayout();

but all of them will set the size of the panel according to it's preferred size, so you should return correct preferredSize and not call setSize() directly
0
 

Author Comment

by:levg
ID: 1247264
It seems to work. Thanks. Grab your points.
0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 200 total points
ID: 1247265
Thanks
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month4 days, 19 hours left to enroll

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question