📄 replacedlg.java
字号:
package jeason;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ReplaceDlg extends JDialog{
private String findStr="",replaceStr="";
///////////////////////////////////////
JLabel txt1=new JLabel("查找:");
JLabel txt2=new JLabel("替换为:");
JTextField txtFind=new JTextField(" ");
JTextField txtReplace=new JTextField(" ");
JButton btn=new JButton("替换");
FlowLayout flowLayout1=new FlowLayout();
ReplaceDlg(Frame frame,String title,boolean modal){
super(frame,title,modal);
this.setTitle("替换为");
this.setSize(200,90);
this.setModal(true);
txt1.setSize(40,60);
txt2.setSize(40,60);
txtFind.setSize(50,60);
txtReplace.setSize(50,60);
btn.setSize(200,20);
btn.addActionListener(new btn_actionAdapter(this));
this.getContentPane().setLayout(flowLayout1);
this.getContentPane().add(txt1,flowLayout1);
this.getContentPane().add(this.txtFind,flowLayout1);
this.getContentPane().add(this.txt2,flowLayout1);
this.getContentPane().add(this.txtReplace,flowLayout1);
this.getContentPane().add(this.btn,flowLayout1);
}
ReplaceDlg(){
this(null,"",false);
}
public void btn_actionPerformed(ActionEvent e){
this.findStr=this.txtFind.getText();
this.replaceStr=this.txtReplace.getText();
this.dispose();
}
public String findStr(){
return this.findStr;
}
public String replaceStr(){
return this.replaceStr;
}
}
class btn_actionAdapter implements java.awt.event.ActionListener{
ReplaceDlg adaptee;
btn_actionAdapter(ReplaceDlg adaptee){
this.adaptee=adaptee;
}
public void actionPerformed(ActionEvent e){
adaptee.btn_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -