资源简介
java在线字典 利用金山词霸在线翻译 很简单的

代码片段和文件信息
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.Jframe;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Mainframe extends Jframe implements ActionListener KeyListener {
public static final int M_WIDTH = 300 M_HEIGHT = 400;
private JPanel toolbar;
private JButton search;
private JTextField keyword;
private JPanel resultArea;
private xmlDownload dl;
Mainframe() {
this.settitle(“在线词典“);
this.setBounds(50 50 M_WIDTH M_HEIGHT);
toolbar = new JPanel();
search = new JButton(“查找“);
keyword = new JTextField(10);
keyword.addKeyListener(this);
toolbar.add(search);
toolbar.add(keyword);
this.add(toolbar BorderLayout.NORTH);
search.addActionListener(this);
resultArea = new JPanel();
this.add(resultArea BorderLayout.CENTER);
dl = new xmlDownload();
this.setVisible(true);
}
public void search() {
String condition = keyword.getText();
System.out.println(condition);
if (!condition.isEmpty()) {
String temp = dl.search(condition);
String[] data = temp.split(“[*]“);
this.remove(resultArea);
resultArea = new JPanel();
resultArea.setBorder(BorderFactory
.createEmptyBorder(20 20 20 20));
resultArea.setLayout(new GridLayout(data.length 0 10 10));
if (!temp.isEmpty()) {
for (String s : data) {
System.out.println(s);
resultArea.add(new JLabel(s));
}
}else{
resultArea.add(new JLabel(“没有找到“));
}
this.add(resultArea BorderLayout.CENTER);
resultArea.updateUI();
this.pack();
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
new Mainframe();
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String key = e.getActionCommand();
System.out.println(key);
if (key.equals(“查找“)) {
this.search();
}
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
int key = e.getKeyCode();
if (key == KeyEvent.VK_ENTER) {
this.search();
}
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-05-31 14:41 Dictionary\
文件 301 2011-12-23 02:36 Dictionary\.classpath
文件 386 2011-12-23 02:36 Dictionary\.project
目录 0 2012-05-31 14:41 Dictionary\.settings\
文件 629 2011-12-23 02:36 Dictionary\.settings\org.eclipse.jdt.core.prefs
目录 0 2012-11-03 18:55 Dictionary\bin\
文件 3440 2012-11-03 18:55 Dictionary\bin\Mainfr
文件 4366 2012-11-03 18:55 Dictionary\bin\xm
文件 801 2012-11-02 23:35 Dictionary\search.xm
目录 0 2012-05-31 14:41 Dictionary\src\
文件 2620 2012-07-05 16:36 Dictionary\src\Mainfr
文件 3253 2012-07-05 17:38 Dictionary\src\xm
- 上一篇:JAVA爬虫批量网页文件
- 下一篇:java混淆器 RetroGuard
相关资源
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- 商店商品管理系统 JAVA写的 有界面
- JAVA开发聊天室程序
- 在linux系统下用java执行系统命令实例
- java期末考试试题两套(答案) 选择(
- JAVA3D编程示例(建模、交互)
- Java 文件加密传输
- java做的房产管理系统
- 基于jsp的bbs论坛 非常详细
- [免费]java实现有障碍物的贪吃蛇游戏
- java Servlet投票实例
评论
共有 条评论