adddictionary.java

来自「用JAVA实现文档检查正误的系统」· Java 代码 · 共 526 行 · 第 1/2 页

JAVA
526
字号
/*
 * AddDictionary.java
 *
 * Created on 2006年12月14日, 上午12:44
 */

package checkspelling;
import java.io.*;
import java.util.*;
import javax.swing.*;
import org.omg.CORBA.portable.ApplicationException;
/**
 *
 * @author  Administrator
 */
public class AddDictionary extends javax.swing.JFrame {
    
    File file=new File("");
    JFileChooser fileChooser1=new JFileChooser();  
    int MessageType=JOptionPane.QUESTION_MESSAGE;
    JFrame frame1=new JFrame();
    private String source="";;
    private String object="";
    private String DicName="";
    private String DelDic="";
    private String Select="";
    private String AddWordDic="";
    private String NewWord="";
    private String DelWordDic="";
    private String DelWord="";
    /** Creates new form AddDictionary */
    public AddDictionary() {
        initComponents();
    }
    
   
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jPanel1 = new javax.swing.JPanel();
        DelDictionary = new javax.swing.JButton();
        SelectDic = new javax.swing.JButton();
        Exit = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jPanel2 = new javax.swing.JPanel();
        Source = new javax.swing.JButton();
        Object = new javax.swing.JButton();
        Copy = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        SeletDicToAdd = new javax.swing.JButton();
        sureAddWord = new javax.swing.JButton();
        Word = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        SelectDicToDel = new javax.swing.JButton();
        DelWord1 = new javax.swing.JButton();
        sureDelWord1 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);
        jPanel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        DelDictionary.setText("\u5220\u9664\u8bcd\u5178");
        DelDictionary.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DelDictionaryActionPerformed(evt);
            }
        });

        SelectDic.setText("\u9009\u62e9\u5220\u9664\u6587\u4ef6");
        SelectDic.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SelectDicActionPerformed(evt);
            }
        });

        Exit.setText("\u9000\u51fa");
        Exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ExitActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, Exit, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, SelectDic, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, DelDictionary, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(SelectDic)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(DelDictionary)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(Exit)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jTextArea1.setText("                            \u7f16\u8f91\u8bcd\u5178\u64cd\u4f5c\u6307\u5357\uff1a\n\u6ce8\u610f\u4e8b\u9879\uff1a\n   \u8bcd\u5178\u548c\u88ab\u68c0\u67e5\u7684\u6587\u4ef6\u7528\u6587\u672c\u4fdd\u5b58\u3002\u8bcd\u5178\u7684\u683c\u5f0f\u4e3a\uff1a\u7b2c\u4e00\u884c\u4e3a\u8bcd\u5178\u540d\u79f0\uff0c\u4ee5\u540e\u6bcf\u4e00\u884c\u653e\u4e00\u4e2a\u82f1\u6587\u5355\u8bcd\u3002\n\n1.\u6dfb\u52a0\u8bcd\u5178\u7684\u64cd\u4f5c\u6d41\u7a0b\uff1a\n   \u6309\u4e0b\u201c\u7f16\u8f91\u8bcd\u5178\u201d\u6309\u94ae\uff0c\u8fdb\u5165\u7f16\u8f91\u754c\u9762\u3002\n   \u6309\u4e0b\u201c\u9009\u62e9\u6e90\u6587\u4ef6\u201d\u6309\u94ae\uff0c\u9009\u62e9\u5f85\u590d\u5236\u7684\u6587\u672c\u6587\u4ef6\uff1b\u6309\u4e0b\u201c\u9009\u62e9\u76ee\u6807\u6587\u4ef6\u201d\u6309\u94ae\uff0c\u9009\u62e9    \u8981\u590d\u5236\u5230\u4f4d\u7f6e\uff1b\u6309\u4e0b\u201c\u590d\u5236\u8bcd\u5178\u201d\u6309\u94ae\u3002\n   \n   2.\u5220\u9664\u8bcd\u5178\u7684\u64cd\u4f5c\u6d41\u7a0b\uff1a\n   \u6309\u4e0b\u201c\u9009\u62e9\u5220\u9664\u8bcd\u5178\u201d\u6309\u94ae\uff0c\u9009\u62e9\u5f85\u5220\u9664\u7684\u6587\u672c\u6587\u4ef6\uff1b\u6309\u4e0b\u201c\u5220\u9664\u201d\u6309\u94ae\u3002\n\n   3.\u6dfb\u52a0\u5355\u8bcd\u7684\u64cd\u4f5c\u6d41\u7a0b\uff1a\n   \u6309\u4e0b\u201c\u9009\u62e9\u8bcd\u5178\u201d\u6309\u94ae\uff0c\u9009\u62e9\u5f85\u6dfb\u52a0\u5355\u8bcd\u7684\u6587\u672c\u6587\u4ef6\uff1b\u6309\u4e0b\u201c\u6dfb\u52a0\u5355\u8bcd\u201d\u6309\u94ae\uff0c\u8f93\u5165\u8981    \u6dfb\u52a0\u7684\u5355\u8bcd\uff1b\u6309\u4e0b\u201c\u786e\u5b9a\u201d\u6309\u94ae\u3002\n\n   4.\u5220\u9664\u5355\u8bcd\u7684\u64cd\u4f5c\u6d41\u7a0b\uff1a\n   \u6309\u4e0b\u201c\u9009\u62e9\u8bcd\u5178\u201d\u6309\u94ae\uff0c\u9009\u62e9\u5f85\u5220\u9664\u5355\u8bcd\u7684\u6587\u672c\u6587\u4ef6\uff1b\u6309\u4e0b\u201c\u5220\u9664\u5355\u8bcd\u201d\u6309\u94ae\uff0c\u8f93\u5165\u8981    \u5220\u9664\u7684\u5355\u8bcd\uff1b\u6309\u4e0b\u201c\u786e\u5b9a\u201d\u6309\u94ae\u3002\n\n");
        jScrollPane1.setViewportView(jTextArea1);

        jPanel2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        Source.setText("\u9009\u62e9\u6e90\u6587\u4ef6");
        Source.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SourceActionPerformed(evt);
            }
        });

        Object.setText("\u9009\u62e9\u76ee\u6807\u6587\u4ef6");
        Object.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ObjectActionPerformed(evt);
            }
        });

        Copy.setText("\u590d\u5236\u8bcd\u5178");
        Copy.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CopyActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(Source, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 108, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                        .add(org.jdesktop.layout.GroupLayout.LEADING, Copy, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(org.jdesktop.layout.GroupLayout.LEADING, Object, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(Source)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(Object)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(Copy)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel3.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        SeletDicToAdd.setText("\u9009\u62e9\u8bcd\u5178");
        SeletDicToAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SeletDicToAddActionPerformed(evt);
            }
        });

        sureAddWord.setText("\u786e\u5b9a");
        sureAddWord.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sureAddWordActionPerformed(evt);
            }
        });

        Word.setText("\u6dfb\u52a0\u5355\u8bcd");
        Word.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                WordActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(Word, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                    .add(sureAddWord, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, SeletDicToAdd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(SeletDicToAdd)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(Word)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(sureAddWord)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel4.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        SelectDicToDel.setText("\u9009\u62e9\u8bcd\u5178");
        SelectDicToDel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SelectDicToDelActionPerformed(evt);
            }
        });

        DelWord1.setText("\u5220\u9664\u5355\u8bcd");
        DelWord1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DelWord1ActionPerformed(evt);
            }
        });

        sureDelWord1.setText("\u786e\u5b9a");
        sureDelWord1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sureDelWord1ActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .add(SelectDicToDel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 98, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(DelWord1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 98, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .add(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .add(sureDelWord1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 98, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .add(SelectDicToDel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(DelWord1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(sureDelWord1)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel1.setText("\u590d\u5236\u8bcd\u5178:");

        jLabel2.setText("\u5220\u9664\u8bcd\u5178:");

        jLabel3.setText("\u6dfb\u52a0\u5355\u8bcd\u5230\u8bcd\u5178:");

⌨️ 快捷键说明

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