一个简单的记事本代码(三)
时间:2011-01-11
/****************************************************/
//行为事件
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == jMenuFileCut)
{
FileCut(e);
}
else if (e.getSource() == jMenuFileCopy)
{
FileCopy(e);
}
else if (e.getSource() == jMenuFilePaste)
{
FilePaste(e);
}
else if (e.getSource() == jMenuFileDel)
{
FileDel(e);
}
else if (e.getSource()==jMenuMouseCut)
{
FileCut(e);
}
else if (e.getSource()==jMenuMouseCopy)
{
FileCopy(e);
}
else if (e.getSource()==jMenuMousePaste)
{
FilePaste(e);
}
else if (e.getSource()==jMenuMouseDel)
{
FileDel(e);
}
else if (e.getSource() == jMenuFileFindNext)
{
FileFindNext(e);
}
else if(e.getSource() ==jMenuFileSelect){
AllSelect(e);
}
else if (e.getSource() ==jMenuFileTime){
FileTime(e);
}
else if(e.getSource()==jMenuCheckBox){
if(check){
FileLine(e);
}
//check=!check;
}
else if (e.getSource() == jMenuFileFont)
{
new Bfont(jTextArea1);
}
else if (e.getSource() == jcolor)
{
fcolor(e);
}
else if (e.getSource() == jMenuHelpAbout)
{
HelpAboutDialog(e);
}
}
/****************************************************/
//主函数
public static void main(String args[]){
new Notepad();
}
//****************************************************
class File_new_actionAdapter implements ActionListener {
public void actionPerformed(ActionEvent e){
File_new_actionPerformed(e);
}
}
class File_open_actionAdapter implements ActionListener {
public void actionPerformed(ActionEvent e){
File_open_actionPerformed(e);
}
}
class File_save_actionAdapter implements ActionListener {
public void actionPerformed(ActionEvent e){
File_save_actionPerformed(e);
}
}
class File_saveto_actionAdapter implements ActionListener {
public void actionPerformed(ActionEvent e){
File_saveto_actionPerformed(e);
}
}
class File_close_actionAdapter implements ActionListener {
public void actionPerformed(ActionEvent e){
File_close_actionPerformed(e);
}
}
//****************************************************************
//查找类
class Frame1 extends JDialog implements ActionListener {
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JTextField jTextField1 = new JTextField();
JTextField jTextField2 = new JTextField();
JCheckBox jCheckBox1 = new JCheckBox("区分大小写",true);
JRadioButton[] teams = new JRadioButton[2];
ButtonGroup jj=new ButtonGroup();
String findstr;
public Frame1(JTextArea jTextArea1) {
try {
findstr=jTextArea1.getText();
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
public void jbInit() throws Exception {
this.getContentPane().setLayout(null);
this.setBounds(120,120,380, 150);
this.setTitle("查找");
this.setModal(true);
jButton1.setText("下一个");
jButton1.setBounds(new Rectangle(273, 7, 91, 20));
Button1Listener next=new Button1Listener();
jButton1.addActionListener(next);
jButton3.setText("替换");
jButton3.setBounds(new Rec
|