This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Canvas + JMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Canvas + JMenu" Watch "Canvas + JMenu" New topic

Canvas + JMenu

Dan Grieve

Joined: Jul 11, 2006
Posts: 8
Hey all, I've spent enough time creating programs etc using just buttons and menus, and thought I'd spread my wings into the 2d graphics land. Thought for my first go I'd set up a simple "Paint" program, and ran into a little issue with the drawing canvas and JMenu's.

I've got 2 classes (which are at the bottom of the post), one to handle the frame, menus, events and whatnot, and the other class just simply extends Canvas and draws an oval. The problem is, when I click on a menu, the menu appears behind the canvas, what can I do to bring either the menu to the front, or send the canvas to the back.



If you could point me in the right direction I'd appreciate it, cheers.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
read this

then change Canvas to JPanel, and use its paintComponent(..) for your graphics
marc weber

Joined: Aug 31, 2004
Posts: 11343

Moving to the Swing 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
I agree. Here's the link:
subject: Canvas + JMenu
It's not a secret anymore!