Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

Graphics Look "Choppy" After Scrolling

Thread view: 
Adam Polt - 27 Mar 2007 20:10 GMT
Hello!

I have implemented a class which extends JPanel in which I've
overridden PaintComponent() to visualize a tree (or graph) using the
Graphics2D package.  I've put this into a jScrollPane, because the
tree is typically bigger than the screen will allow.  The graphics
work nicely, but once the panel is scrolled, it "chops up" the image
(on the part that was originally not shown.)

I was wondering if anyone knew of a simple (or not simple, but simple
is preferable, obviously) way to fix this problem.

Thanks for your help!

-Adam
A. Bolmarcich - 27 Mar 2007 20:40 GMT
> Hello!
>
[quoted text clipped - 9 lines]
>
> Thanks for your help!

As an initial experiment, invoke

 getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE)

on the JScrollPane.  If that eliminates the "chopping up" of the portion
of the JPanel exposed by scrolling, and you are not concerned about
scrolling performance, then you are done.
Adam Polt - 27 Mar 2007 22:11 GMT
On Mar 27, 2:40 pm, "A. Bolmarcich" <agge...@earl-grey.cloud9.net>
wrote:

> > Hello!
>
[quoted text clipped - 17 lines]
> of the JPanel exposed by scrolling, and you are not concerned about
> scrolling performance, then you are done.

This seems to fix the problem.  Thank you very much!

-Adam
Daniel Pitts - 27 Mar 2007 21:32 GMT
> Hello!
>
[quoted text clipped - 11 lines]
>
> -Adam

It very well could be that you are rendering from the wrong thread.
Make sure you are following the single-thread-access idiom used in
Swing.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.