super("MainFrame-Look and Feel");
setBounds(100,100,600,400);
setBackground(Color.white);
buildContent();
Container cp=getContentPane();
cp.setLayout(new BorderLayout());
cp.add("North",buildMenu());
//buildMenu();
show();
addMouseMotionListener(this);
addMouseListener(this);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
quit();
}
});//end of addWindowListener
}//end of main protected void buildContent() {
desktop = new JDesktopPane();
getContentPane().add(desktop); }//end of buildContent() protected JMenuBar buildMenu(){
MBar = new JMenuBar();
MBar.setOpaque(true);
JMenu mfile = buildFileMenu(); MBar.add(mfile); setJMenuBar(MBar);
return MBar;
}//end of bulidMenu()
以上是程序更改部分,其于不变,声明框架后要产生容器!
setBounds(100,100,600,400);
setBackground(Color.white);
buildContent();
Container cp=getContentPane();
cp.setLayout(new BorderLayout());
cp.add("North",buildMenu());
//buildMenu();
show();
addMouseMotionListener(this);
addMouseListener(this);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
quit();
}
});//end of addWindowListener
}//end of main protected void buildContent() {
desktop = new JDesktopPane();
getContentPane().add(desktop); }//end of buildContent() protected JMenuBar buildMenu(){
MBar = new JMenuBar();
MBar.setOpaque(true);
JMenu mfile = buildFileMenu(); MBar.add(mfile); setJMenuBar(MBar);
return MBar;
}//end of bulidMenu()
以上是程序更改部分,其于不变,声明框架后要产生容器!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货