jQuery in Action, 2nd edition*
The moose likes Swing / AWT / SWT and the fly likes how to draw lines without change background's image? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to draw lines without change background Watch "how to draw lines without change background New topic
Author

how to draw lines without change background's image?

eric zheng
Greenhorn

Joined: Jun 27, 2003
Posts: 5
I draw an image in Jpanel as background,and following want to achieve lines or circles movement on the panel. however, when the line move using draw a white color line to overwrite, the background's image changed as well. how can I achieve move the lines without change the image?
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Norm Miller
Ranch Hand

Joined: May 21, 2002
Posts: 56
Pursuing this answer a bit further:

Is there any good to be gained by taking advantage of the various layers that the Swing model makes available? I.e., draw the image as shown, but put the ball on the Transparent layer.

If you want to mouse click on the ball, does the answer remain the same?

Thanks
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Is there any good to be gained by taking advantage of the various layers that the Swing model makes available? I.e., draw the image as shown, but put the ball on the Transparent layer.

I don't notice any advantage. It seems like one advantage of drawing on a transparent top layer would be to preserve the drawing while we swap or manipulate the image below.

If you want to mouse click on the ball, does the answer remain the same?

It seems to. Let's try it and see:
Norm Miller
Ranch Hand

Joined: May 21, 2002
Posts: 56
That is very neat!

Thank you.
eric zheng
Greenhorn

Joined: Jun 27, 2003
Posts: 5
Thanks a lot!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to draw lines without change background's image?
 
Similar Threads
How to draw lines without cover the background's image?
creating lines a la Guide Lines in Photoshop
GC question (code)
Can anyone tell me how to draw something(example: circle,lines ) on an image ?
Draw lines over background's image, save image & edit lines