[3369] in java-interest

home help back first fref pref prev next nref lref last post

Drawing on Panels

daemon@ATHENA.MIT.EDU (Andy Straw)
Thu Nov 9 13:17:11 1995

Date: Thu, 9 Nov 1995 11:14:44 -0500
From: straw@itc.kodak.com (Andy Straw)
To: java-interest@java.sun.com

I would like to be able to draw a highlight or border on a Panel.

In particular, I have a Panel which contains a Canvas (displaying an
Image) and some Labels (describing the Image).  When the user clicks on
the Panel, I'd like to indicate that this image is selected by drawing
a border around the Panel, not just the Canvas.

When I try to draw in my Panel's paint() method, none of the drawing
commands (drawRect(), e.g.) seem to work.  I can get them to work on my
Canvas, but the same code doesn't seem to work on my Panel.

Is it possible to draw on a Panel, or can I draw only on a Canvas?

Are there other approaches to doing what I want?  Changing the Panel's
background color is one alternative I've considered, though it doesn't
look the way I'd like it to.  Using one Canvas (no Panel), and drawing
the text myself, rather using Labels, is also possibility, but requires
me to deal with laying out the text on the Canvas; a Panel, being a
container, has a LayoutManager, which is nice.

Thanks for any help.

Andy Straw
Eastman Kodak Company
straw@itc.kodak.com
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post