Meaningless Drivel is fun!*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Canvas + JMenu" Watch "Canvas + JMenu" New topic
Author

Canvas + JMenu

Dan Grieve
Greenhorn

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.

Paint.class
----------------------------------------



Drawing.class
----------------------------------------



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
http://java.sun.com/products/jfc/tsc/articles/mixing/

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

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
sscce.org
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Canvas + JMenu
 
Similar Threads
Run time error...tricky one..
JMenuBar in an Applet : Good vs Bad Code Practice?
How can I add another text box under this layout?
Help Please Urgent
Things arn't showing up...