日期:2014-05-20  浏览次数:20695 次

下面程序增加什么代码后才会有弹出式菜单?
下面程序增加什么代码后才会有弹出式菜单?
帮我改一下程序吧!谢谢!!!!!
package   ygp;

import   java.applet.*;  
import   java.io.*;
import   java.awt.*;
import   java.awt.event.*;
import   javax.swing.*;
import   com.borland.jbcl.layout.*;

public   class   Frame1   extends   JFrame   {
        JPanel   contentPane;
        JMenuBar   jMenuBar1   =   new   JMenuBar();
        JMenu   jMenu1   =   new   JMenu();
        JMenu   jMenu2   =   new   JMenu();
        JMenuItem   jMenuItem1   =   new   JMenuItem();
        JMenuItem   j1   =   new   JMenuItem();
        JMenuItem   jMenuItem3   =   new   JMenuItem();
        JMenuItem   jMenuItem4   =   new   JMenuItem();
        JTextArea   t1   =   new   JTextArea();
        JScrollPane   tools=new   JScrollPane(t1);
        JMenuBar   jMenuBar2   =   new   JMenuBar();
        GridBagLayout   gridBagLayout1   =   new   GridBagLayout();
        JMenuBar   jMenuBar3   =   new   JMenuBar();
        Button   button1   =   new   Button();  
        public   Frame1()   {
                try   {
                        setDefaultCloseOperation(EXIT_ON_CLOSE);
                        jbInit();
                }   catch   (Exception   exception)   {
                        exception.printStackTrace();
                }
        }

        /**
          *   Component   initialization.
          *
          *   @throws   java.lang.Exception
          */
        private   void   jbInit()   throws   Exception   {
                contentPane   =   (JPanel)   getContentPane();
                contentPane.setLayout(gridBagLayout1);

                this.setJMenuBar(jMenuBar1);
                setSize(new   Dimension(400,   300));
                setTitle( "编辑器 ");
                jMenu1.setText( "文件 ");
                jMenu2.setText( "编辑 ");
                j1.setText( "打开 ");
                j1.addActionListener(new   Frame1_jMenuItem2_actionAdapter(this));
                jMenuItem1.setText( "退出 ");