系统有很多jPanel,每个Jpanel都有不同的JMenubar,为将JMenuBar与JToolbar放到JPanel中可采用如下方法:
public class BasicGraphEditor extends JPanel
...
protected void installToolAndMenuBar() {
JPanel jp = new JPanel();
jp.setLayout(new BorderLayout());
jp.add(new EditorToolBar(this, JToolBar.HORIZONTAL), BorderLayout.CENTER);
jp.add(new EditorMenuBar(this), BorderLayout.NORTH);
add(jp ,BorderLayout.NORTH);
}