用Java程序编写一个记事本程序的
设 计 报 告
学习中心(点):        泾阳学习中心         
专    业          计算机科学与技术       
层    次    :          专升本           
*    *    *      *    *    *       
批    次    :            112             
一、设计分析    1
二、程序结构    1
三、各模块的功能及程序说明    2
1、类设计    2
2、主要功能代码实现    4
四、源程序    9
五、操作方法    20
六、试验结果    20
七、设计体会    22

用Java程序编写一个记事本程序的设计报告
一、设计要求   
1.用图形用户界面实现。
2.能实现编辑、保存、另存为、查替换等功能。
二、程序结构
程图:
图1基本流程图
本Java文本编辑器功能设计如下:
图2基本功能图
三、各模块的功能及程序说明
1、类设计
(1)类MiniText ,包括  initTextPane方法初始化面板, initMenu()方法初始化菜单, initAboutDialog()方法初始化关于对话框, initToolBar()方法初始化工具栏, initRightKey()方法初始化右键设置,等方法。类成员如下:
(2)类Loading (实现登陆)
类成员如下:
   
(3)类runtime  (实现时间同步)
类成员如下:
(4)类MainFunction  (包含主函数)
类成员如下:
2、主要功能代码实现
(1)登陆界面:
class Loading extends JWindow implements Runnable {
  Thread dluThread=null;
  private JProgressBar progress;
  public Loading() {
    PredefinedCursor(Cursor.WAIT_CURSOR));//设置光标为等待状态
    JPanel dlu = new JPanel(new BorderLayout());
    URL url = getClass().getResource("/images/loading.jpg");
    if(url != null){
      dlu.add(new JButton(new ImageIcon(url)), BorderLayout.CENTER);
    }
    progress = new JProgressBar(1,100);
    progress.setStringPainted(true);
    progress.setBorderPainted(true);
    progress.setBackground(Color.white);
    progress.);
    dlu.add(progress,BorderLayout.SOUTH);
    setContentPane(dlu);      //设置窗口属性为登陆面板属性
    Dimension screen = getToolkit().getScreenSize();
    pack();          //显示登陆界面
    setLocation(screen.width/4,screen.height/4);  //设置登陆界面始终在屏幕中间显示
  }
  public void start(){
  // Front();
    dluThread=new Thread(this);
    dluThread.start();  }
  public void run(){
    show();
    try {
      for (int i=0;i<100;i++){
        Thread.sleep(100);
        progress.Value() + 1);
        progress.setString("欢迎进入迷你编辑,请稍后... ...                                        "+i+"%");      }    }
    catch (Exception ex) {
      ex.printStackTrace();    }
    dispose();//关闭登陆界面  } }
(2).时间标签:
class runtime extends JButton implements Runnable{
              Thread datetime=null;
        public runtime(){}   
              public void run(){
            for(;;){
                //java.util.Date timeer=new java.util.Date();
                Calendar Instance();
                  int (Calendar.YEAR);
                int (Calendar.MONTH);
                int (Calendar.DAY_OF_MONTH);
                int (Calendar.HOUR);
                int (Calendar.MINUTE);
                int (Calendar.SECOND);
                setText(year1+"年"+month1+"月"+day1+"日 "+hour1+":"+minute1+":"+sec);
                //System.out.(Calendar.DAY_OF_MONTH)-60);
                try{
                    Thread.currentThread().sleep(1000);
                }catch(InterruptedException e){}              }        }}     
 
(3)右键的实现:
   
void initRightKey (){
filepopup=new JPopupMenu();
uundo=new JMenuItem("撤消(U)");
uundo.setMnemonic('U');
ccut=new JMenuItem("剪切(T)");
ccut.setMnemonic('T');
ccopy=new JMenuItem("复制(C)");
ccopy.setMnemonic('C');
ppaste=new JMenuItem("粘贴(V)");
ppaste.setMnemonic('V');
用java编写一个简单的计算器ddelete=new JMenuItem("删除(D)");
ddelete.setMnemonic('D');
sselectall=new JMenuItem("全选(A)");
sselectall.setMnemonic('A');
filepopup.add(uundo);
filepopup.addSeparator();
filepopup.add(ccut);
filepopup.add(ccopy);
filepopup.add(ppaste);
filepopup.add(ddelete);
filepopup.addSeparator();
filepopup.add(sselectall);
uundo.addActionListener(action);
ccut.addActionListener(action);
ccopy.addActionListener(action);
ppaste.addActionListener(action);
ddelete.addActionListener(action);
sselectall.addActionListener(action);
text.addMouseListener(new MouseAdapter(){
    public void mousePressed(MouseEvent event){