Custom graphics repainting

Posted on 2003-03-07
Medium Priority
Last Modified: 2010-03-31
I have a JPanel on which custom graphics are painted using Graphics2D.  Sometimes the graphics will take a few seconds to draw, but the JPanel is blank until everything has been drawn, then the custom graphics are displayed.

I would like the JPanel to display the graphics as they are being drawn so the user can see what is being drawn instead of looking at a blank screen for sometimes 5 or 6 seconds.  Using just Graphics (as opposed to Graphics2D) and a Panel, it did this automatically, but now (because of Swing double-buffering I think?), it doesn't.  

Is there a way in which I can force output to the screen as its being repainted, without losing the double-buffering?
Question by:nintoid
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

antonsigur earned 160 total points
ID: 8093654
Hi, have you tried calling updateUI(); on the JPanel? It should update the GUI so it should display the graphics as they are on that moment.

I've had simmelar problems with controls that I'm editing from inside (custom controls) ( they didn't update until I called updateUI(); )

Author Comment

ID: 8093753
Thanks, i'll give it a try.

Expert Comment

ID: 9058855
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.
LVL 35

Expert Comment

ID: 9687103
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to antonsigur

Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

762 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