资源简介
用Java开发的简易记事本,功能包括基本的复制、粘贴、剪切、撤销、重做、替换、查找、字体、字数统计及文件基本操作。可供学习使用

代码片段和文件信息
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.Jframe;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
public class Find extends Jframe {
/**
*
*/
private static final long serialVersionUID = 1L;
JLabel label1=new JLabel(“查找内容“);
JCheckBox checkBox=new JCheckBox(“区分大小写“);
JTextField textField=new JTextField();
JButton findButton=new JButton(“查找下一个“);
JButton cancelButton=new JButton(“取消“);
String findword=new String();
String text=new String();
int index;
public Find(final MyPanel my)
{
this.setLayout(null);
settitle(“查找“);
label1.setBounds(1057030);
textField.setBounds(701016020);
findButton.setBounds(230 10 100 20);
checkBox.setBounds(103514020);
cancelButton.setBounds(2303510020);
this.add(label1);
findButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
findword=textField.getText();
text=my.textArea.getText();
if(!checkBox.isSelected())
{
text=text.toLowerCase();
findword=findword.toLowerCase();
}
index=text.indexOf(findword my.textArea.getCaretPosition());
if(index!=-1)
{
System.out.println(index+ “ “+ findword.length());
my.textArea.setCaretPosition(index+findword.length());
my.textArea.select(index findword.length()+index);
}
else{
JOptionPane.showMessageDialog(Find.this “找不到“+“ “+findword+“ ““记事本“JOptionPane.WARNING_MESSAGE);
}
}
});
this.setAlwaysOnTop(true);
this.add(findButton);
this.add(textField);
this.add(checkBox);
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
Find.this.setVisible(false);
}
});
this.add(cancelButton);
this.setSize(350 100);
this.setVisible(false);
this.setDefaultCloseOperation(HIDE_ON_CLOSE);
this.setLocationRelativeTo(null);
}
public void Show() {
// TODO Auto-generated method stub
this.setVisible(true);
}
public String Getfindword() {
return findword;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 301 2012-05-10 10:11 notepad\.classpath
文件 383 2012-05-10 10:11 notepad\.project
文件 2365 2012-05-16 18:10 notepad\src\Find.java
文件 5186 2012-05-16 18:04 notepad\src\Fonts.java
文件 17259 2012-05-20 23:03 notepad\src\MyPanel.java
文件 3799 2012-05-16 18:07 notepad\src\Replace.java
文件 2086 2012-05-16 20:19 notepad\bin\Find$1.class
文件 620 2012-05-16 20:19 notepad\bin\Find$2.class
文件 2065 2012-05-16 20:19 notepad\bin\Find.class
文件 888 2012-05-16 20:19 notepad\bin\Fonts$1.class
文件 887 2012-05-16 20:19 notepad\bin\Fonts$2.class
文件 1029 2012-05-16 20:19 notepad\bin\Fonts$3.class
文件 938 2012-05-16 20:19 notepad\bin\Fonts$4.class
文件 615 2012-05-16 20:19 notepad\bin\Fonts$5.class
文件 835 2012-05-16 20:19 notepad\bin\Fonts$6.class
文件 4753 2012-05-16 20:19 notepad\bin\Fonts.class
文件 583 2012-05-20 23:03 notepad\bin\MyPanel$1.class
文件 592 2012-05-20 23:03 notepad\bin\MyPanel$2.class
文件 1034 2012-05-20 23:03 notepad\bin\MyPanel$3.class
文件 581 2012-05-20 23:03 notepad\bin\MyPanel$4.class
文件 884 2012-05-20 23:03 notepad\bin\MyPanel$5.class
文件 13595 2012-05-20 23:03 notepad\bin\MyPanel.class
文件 1864 2012-05-16 20:19 notepad\bin\Replace$1.class
文件 1753 2012-05-16 20:19 notepad\bin\Replace$2.class
文件 1090 2012-05-16 20:19 notepad\bin\Replace$3.class
文件 638 2012-05-16 20:19 notepad\bin\Replace$4.class
文件 2546 2012-05-16 20:19 notepad\bin\Replace.class
文件 629 2012-05-10 10:11 notepad\.settings\org.eclipse.jdt.core.prefs
目录 0 2012-05-24 10:11 notepad\src
目录 0 2012-05-24 10:11 notepad\bin
............此处省略5个文件信息
- 上一篇:javacc编译原理实习
- 下一篇:J2EE的13种核心模式
相关资源
- java图片浏览器跨平台运行程序与源码
- 基于java的在线考试系统-毕业设计
- 微博系统(Java源码,servlet+jsp),适
- java串口通信全套完整代码-导入eclip
- 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 文件加密传输
评论
共有 条评论