This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes What to draw on? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "What to draw on?" Watch "What to draw on?" New topic
Author

What to draw on?

Liz Hundy
Greenhorn

Joined: Feb 21, 2006
Posts: 11
Hello,

I want to make a dynamic picture in my application.

So I made a subclass of Canvas and made a very nice drawing.

But now I find that my JComboBox insists on opening behind the canvas.

So what should I do to make a drawing that goes behind the drop-down of a JComboBox?

---Liz
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
JPanel.


There is no emoticon for what I am feeling!
Liz Hundy
Greenhorn

Joined: Feb 21, 2006
Posts: 11
Thanks.

That works a treat.

---Liz
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Matti Poro
Ranch Hand

Joined: Dec 03, 2005
Posts: 41
Or JComponent. Canvas is a heavy-weight (AWT) component and the classes which start with J are light-weight components (Swing). You shouldn't usually mix AWT and Swing in your program because it can cause problems like the one you experienced.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Moving to Swing/AWT forum...


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What to draw on?
 
Similar Threads
Canvas vs Applet painting
draw image problems Canvas
canvas on JTabbedPane
paint with canvas
(J)ScrollPane trouble : I want to have scroll bars while the size of image get too large