JMenuBar a little off
My MenuBar does not display exactly like i want it to. It seems to be 1 or 2 px off, both in x and y position - compared to the JMenuBar example and to apps like firefox.
What can i do to fix this?
my app is basically 4 files.
1. Main - setting up L&F to system and starting my mainFrame
2. MainFrame - creates a JFrame and sets a menubar and contentpane from 2 other files
3. MenuFrame - the JMenuBar of MainFrame
4. Desktop - the ContentPane of MainFrame
MAINFRAME:
public MainFrame(){
//create a mainFrame
JFrame mainFrame =new JFrame();
MenuFrame menuBar =new MenuFrame();
Desktop desktop =new Desktop();
mainFrame.setJMenuBar(menuBar.createMenuBar());
mainFrame.setContentPane(desktop.createContentPane());
//set attributes for menuBar
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setTitle("Sequencer");
mainFrame.setVisible(true);
//maximize window (must be placed after setVisible)
mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
}
CREATEMENUBAR (method inside MenuFrame)
public JMenuBar createMenuBar(){
//Create menubar
menuBar =new JMenuBar();
menuBar.add(createFileMenu());
menuBar.add(createEditMenu());
System.out.println(menuBar.getMargin());
return menuBar;
}
Hope this makes sense
Carsten

