JMenuItems drawn over by JPanel. How to fix?
Hi.
When i add my menu to the frame the actual menu bar displays fine. but when you open the menu the items are drawn over by my jpanel.
I tried a way to work around it by adding the menu to the jpanel. when i did this the menu worked and displayed fine, but it wasn't really wanted (it wasn't being mounted to the top of the frame like the title bar, but instead a component centered on the canvas).
I want the menu bar to be positioned like any other gui application and use my jpanel for the drawing area. is there some way to let java know i want to display the menu over the jpanel?
Heres the basic structure of the code i'm using:
publicclass Simulateextends JAppletimplements MouseMotionListener, MouseListener{
staticprivate JFrame frame;
private Container content;
private Display drawing_surface;
private JMenuBar menu_bar;
publicstaticvoid main(String []args){
init_frame();
}
public Simulate(){
drawing_surface=new Display();
setContentPane(drawing_surface);
content=getContentPane();
/* add menu items */
}
staticvoid init_frame(){
frame=new JFrame();
frame.getContentPane().add(new Simulate());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
class Displayextends JPanel{
publicvoid paintComponent(Graphics g){
paint_buffer(g);
}
publicvoid paint_buffer(Graphics g){
/* paint here */
}
}

