mix use of Swing and AWT

package picture;
    import javax.swing.JLabel;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
  class project extends JFrame {
       private JMenuBar mb = new JMenuBar();
       private JMenu mm =new JMenu("文件");
       private JMenu mm2 =new JMenu("编辑");
       private JMenuItem mi1 =new JMenuItem("新建");
       private JMenuItem mi2=new JMenuItem("打开");
       private JMenuItem mi3 =new JMenuItem("Copy");
       private JMenuItem mi4 =new JMenuItem("cut");
       private JLabel mm5=new JLabel();

public project(){
         this.setLayout(null);
//装配菜单栏
        mm.add(mi1);
         mm.add(mi2); 
         mm2.add(mi3);
         mm2.add(mi4);
         mb.add(mm);
         mb.add(mm2);
         this.setJMenuBar(mb);
         mm5.setText("好好学习,天天向上");
          mm5.setBounds(10,10,450,30);
          this.add(mm5);
          this.setBounds(330,250,500,150);
          this.setVisible(true);



}
public static void main(String[] agrs){
          new project();
}

posted @ 2015-04-28 14:05  Leslie-L  阅读(148)  评论(0)    收藏  举报