⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainframe.java

📁 3种用Java写的算法 其中包括了DES凯撒 编译软件用的是Intell J IDEA
💻 JAVA
字号:

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 * Created by IntelliJ IDEA.
 * User: ${040421220 郑天南}
 * Date: 2007-4-16
 * Time: 16:12:33
 */
public class mainFrame
{
    public static void main(String[] args)
    {
          coFrame frame=new coFrame();
          frame.setDefaultCloseOperation(coFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
    }
}

class coFrame extends JFrame
{
      public coFrame()
      {
            dimframe=new Dimension(200,550);
            this.setSize(dimframe);
            this.setTitle("MainFrame");
            Container cp=getContentPane();
            coPanel panel=new coPanel();
            cp.add(panel);
      }

    private Dimension dimframe;
}

class coPanel extends JPanel
{
    public coPanel()
    {
        addfriend = new JButton("Add Friend");
        addfriend.addActionListener(new ActionListener()
                                        {
                                          public void actionPerformed(ActionEvent event)
                                          {
                                              add();
                                          }
                                        });
        add(addfriend);

    }

    public void  add()
    {
        afDialog=new JDialog();
        afDialog.setTitle("添加您的联系人");
        afDialog.setSize(200,200);
        afDialog.setLocation(200,0);
        Dpanel dpanel=new Dpanel();
        afDialog.add(dpanel);
        afDialog.setVisible(true);


    }

    class Dpanel extends JPanel
    {
        public Dpanel()
        {
         label1 = new JLabel("请输入你要添加的联系人姓名");
         nof = new JTextField(10);
         submit= new JButton("OK");
         submit.addActionListener(new ActionListener()
                                        {
                                          public void actionPerformed(ActionEvent event)
                                          {
                                              ok();
                                          }
                                        });
         add(submit);
         add(label1);
         add(nof);
        }



        private JLabel label1;
        private JButton submit;
    }

    public void ok()
    {
          button=new JButton(nof.getText());
          this.add(button);
    }

    private JTextField nof;
    private JButton button;
    private JButton addfriend;
    private JDialog afDialog;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -