Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Canvas + JMenu

 
Dan Grieve
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Swing forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic