zoukankan      html  css  js  c++  java
  • GUI_菜单练习

    package com.mywindow.test;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    
    import javax.swing.JDialog;
    import javax.swing.JFileChooser;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.WindowConstants;
    import javax.swing.SwingUtilities;
    
    
    /**
    * This code was edited or generated using CloudGarden's Jigloo
    * SWT/Swing GUI Builder, which is free for non-commercial
    * use. If Jigloo is being used commercially (ie, by a corporation,
    * company or business for any purpose whatever) then you
    * should purchase a license for each developer using Jigloo.
    * Please visit www.cloudgarden.com for details.
    * Use of Jigloo implies acceptance of these licensing terms.
    * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
    * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
    * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
    */
    public class MyMenu extends javax.swing.JFrame {
        private JMenuBar jMenuBar1;
        private JMenu jMenu5;
        private JMenuItem jMenuItem3;
        private JMenuItem jMenuItem2;
        private JMenuItem jMenuItem1;
        private JMenu jMenu6;
        private JMenu jMenu4;
        private JMenu jMenu3;
        private JMenu jMenu2;
        private JMenu jMenu1;
        //private JFileChooser chooser;
        private JDialog dialog;
        /**
        * Auto-generated main method to display this JFrame
        */
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    MyMenu inst = new MyMenu();
                    inst.setLocationRelativeTo(null);
                    inst.setVisible(true);
                }
            });
        }
        
        public MyMenu() {
            super();
            initGUI();
        }
        
        private void initGUI() {
            try {
                setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                {
                    jMenuBar1 = new JMenuBar();
                    setJMenuBar(jMenuBar1);
                    {
                        jMenu1 = new JMenu();
                        jMenuBar1.add(jMenu1);
                    }
                    {
                        jMenu2 = new JMenu();
                        jMenuBar1.add(jMenu2);
                        jMenu2.setText("u6587u4ef6");
                        {
                            jMenuItem1 = new JMenuItem();
                            jMenu2.add(jMenuItem1);
                            jMenuItem1.setText("u6253u5f00");
                            jMenuItem1.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent evt) {
                                    jMenuItem1ActionPerformed(evt);
                                }
                            });
                        }
                    }
                    {
                        jMenu3 = new JMenu();
                        jMenuBar1.add(jMenu3);
                        jMenu3.setText("u7f16u8f91");
                        {
                            jMenuItem2 = new JMenuItem();
                            jMenu3.add(jMenuItem2);
                            jMenuItem2.setText("u590du5236");
                        }
                        {
                            jMenuItem3 = new JMenuItem();
                            jMenu3.add(jMenuItem3);
                            jMenuItem3.setText("u526au5207");
                        }
                    }
                    {
                        jMenu4 = new JMenu();
                        jMenuBar1.add(jMenu4);
                        jMenu4.setText("u67e5u770b");
                    }
                    {
                        jMenu5 = new JMenu();
                        jMenuBar1.add(jMenu5);
                        jMenu5.setText("u5de5u5177");
                    }
                    {
                        jMenu6 = new JMenu();
                        jMenuBar1.add(jMenu6);
                        jMenu6.setText("u5e2eu52a9");
                    }
                }
                pack();
                setSize(400, 300);
            } catch (Exception e) {
                //add your error handling code here
                e.printStackTrace();
            }
        }
        
        private void jMenuItem1ActionPerformed(ActionEvent evt) {
            dialog = new JDialog(this);
            dialog.setVisible(true);
        //    chooser = new JFileChooser();
        //    chooser.setVisible(true);
        }
    
    }
  • 相关阅读:
    Linux下的/dev/sr0、/dev/cdrom、df命令、free命令
    CentOS6.8 yum升级高版本gcc
    php5.6配置oracle数据库扩展 oci8(windows7系统64位)
    linux命令之ifconfig
    linux 编译安装swoole
    Bootstrap面包屑导航
    bootstrap滚动监听
    bootstrap弹出框
    Bootstrap 模态框(也可以说的弹出层)
    java反射拼接方法名动态执行方法
  • 原文地址:https://www.cnblogs.com/LO-ME/p/3606236.html
Copyright © 2011-2022 走看看