英汉词典 JaVa_一个Java编写的英汉词典

这是一个使用Java编写的简单英汉词典应用程序。开发者请求帮助为代码添加详细注释,程序包括一个输入框、查询按钮和显示查询结果的文本区域。查询功能通过SQL查询在数据库中匹配字符发音来查找汉字。
摘要由CSDN通过智能技术生成

这是用Java编写的英汉词典,希望有人能帮我详细的注释一遍,我还是个菜鸟,不胜感激啊……/**Tochangethistemplate,chooseTools|Templates*andopenthetemplateintheeditor.*/packaged...

这是用Java编写的英汉词典,希望有人能帮我详细的注释一遍,我还是个菜鸟,不胜感激啊……

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

package dic;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.tree.*;

import java.sql.*;

import javax.swing.event.*;

import java.util.*;

import javax.swing.border.*;

import javax.swing.table.*;

import java.lang.String.*;

import java.lang.System;

class Mywindow extends JFrame implements ActionListener

{

JTextField txf=new JTextField(20);

JTextArea jt=new JTextArea(10,30);

JButton btn1=new JB

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
package shiyan; import java.awt.*; import java.awt.event.*; import java.sql.*; import javax.swing.*; public class AddWin extends JFrame implements ActionListener { private static MySqlUtils mySqlUtils = new MySqlUtils(); JTextField 添加汉语解释_文本条, 添加英语单词_文本条; JButton addbtn, cancelbtn; Connection Con = null; Statement Stmt = null; public AddWin() { super("添加单词"); this.setBounds(250, 250, 250, 200); this.setVisible(true); JPanel p1 = new JPanel(); p1.add(new Label("输入要添加的单词:")); 添加英语单词_文本条 = new JTextField(20); p1.add(添加英语单词_文本条); p1.add(new Label("输入添加的单词的解释:")); 添加汉语解释_文本条 = new JTextField(20); p1.add(添加汉语解释_文本条); addbtn = new JButton("提交"); cancelbtn = new JButton("取消"); p1.add(addbtn); p1.add(cancelbtn); this.add(p1); addbtn.addActionListener(this); cancelbtn.addActionListener(this); this.validate(); } public void actionPerformed(ActionEvent e) { if (e.getSource() == addbtn) { if (添加英语单词_文本条.getText().equals("") || 添加汉语解释_文本条.getText().equals("")) { JOptionPane.showMessageDialog(this, "添加的单词或解释不能为空~", "警告", JOptionPane.WARNING_MESSAGE); } else { try { Word word = new Word(); word.setEnglish(添加英语单词_文本条.getText().toString()); word.setChinese(添加汉语解释_文本条.getText().toString()); mySqlUtils.insert(word); 添加英语单词_文本条.setText(""); 添加汉语解释_文本条.setText(""); } catch (Exception ee) { } } } else if (e.getSource() == cancelbtn) { dispose(); } } }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值