Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to distinglish causes of Repaint events

Posted on 1998-01-02
1
Medium Priority
?
418 Views
Last Modified: 2010-05-18
Does anybody know within the callback method
"paint(Graphics)", how can we distinglish between whether it
is ...
a) Caused by component movement (e.g. when I drag a
   component over other components)
OR
b) Caused by window exposure (e.g. when I drag another
   window over my applet)

For yr background information, I need to distinglish
them and handle in a different way in order to support drag
& drop of components in my applet.

In the moving component in case (a), I need to erase the
current location before I draw and on a new location.  I
also use myGraphics.setXORMode(..) to ensure it doesn't
erase its path.

In case (b), I just erase the whole applet and redraw it.

Best regards,
Ricky
0
Comment
Question by:hori
[X]
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
1 Comment
 
LVL 4

Accepted Solution

by:
russgold earned 100 total points
ID: 1231923
The AWT does not support any way to tell why paint is being called; generally, if you are trying to minimize repainting, you keep an offscreen bitmap and just copy it to the screen during paint.

The best that you can do is to keep track of your own invalidations and recompute those areas only.  For an example of how this might work, check:

http://www.netaxs.com/~russgold/java_samples/dragTest.html

which includes a JDK 1.02-compatible drag-and-drop demo that I wrote a while ago.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

618 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