📄 finddlg.java
字号:
package jeason;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FindDlg extends JDialog{
private String findstr;
private boolean flag=true;
JLabel findText=new JLabel("查找内容");
JTextField strText=new JTextField(" ");
JButton btnNext=new JButton( );
JButton btnUp=new JButton( );
FlowLayout flowLayout1=new FlowLayout();
FindDlg(Frame frame,String title, boolean modal){
super(frame,title,modal);
this.setTitle("查找");
this.setSize(200,90);
this.setModal(true);
findText.setText(" 查找内容 ");
findText.setSize(70,60);
strText.setText(" ");
strText.setSize(130,60);
btnNext.setText("向下查找");
btnNext.setSize(100,40);
btnNext.addActionListener(new btnNext_actionAdapter(this));
btnUp.setText("向上查找");
btnUp.setSize(100,40);
btnUp.addActionListener(new btnUp_actionAdapter(this));
this.getContentPane().setLayout(flowLayout1);
this.getContentPane().add(this.findText,flowLayout1);
this.getContentPane().add(this.strText,flowLayout1);
this.getContentPane().add(this.btnNext,flowLayout1);
this.getContentPane().add(this.btnUp,flowLayout1);
}
FindDlg(){
this(null,"",false);
}
public void btnNext_actionPerformed(ActionEvent e){
this.findstr=this.strText.getText();
this.flag=true;
this.dispose();
}
public void btnUp_actionPerformed(ActionEvent e){
this.findstr=this.strText.getText();
this.flag=false;
this.dispose();
}
public String getFindStr(){
return this.findstr;
}
public boolean getFlag(){
return this.flag;
}
}
class btnNext_actionAdapter implements java.awt.event.ActionListener{
FindDlg adaptee;
btnNext_actionAdapter(FindDlg adaptee){
this.adaptee=adaptee;
}
public void actionPerformed(ActionEvent e){
adaptee.btnNext_actionPerformed(e);
}
}
class btnUp_actionAdapter implements java.awt.event.ActionListener{
FindDlg adaptee;
btnUp_actionAdapter(FindDlg adaptee){
this.adaptee=adaptee;
}
public void actionPerformed(ActionEvent e){
adaptee.btnUp_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -