📄 filedialogexample.java
字号:
import java.awt.*;
import java.awt.event.*;
public class FileDialogExample
implements ActionListener{
Frame f;
Button b;
TextArea ta;
FileDialog fd;
static public void main(String args[]) {
FileDialogExample fde = new FileDialogExample();
fde.go();
}
public void go() {
f = new Frame("FileDialog Example");
b = new Button("Show FileDialog");
b.addActionListener(this);
f.add("South",b);
ta = new TextArea();
f.add("Center",ta);
fd = new FileDialog(f,"FileDialog");
f.setSize(350,150);
f.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
fd.setVisible(true);
ta.setText("Directory :"+fd.getDirectory());
ta.append("\nFilename :"+fd.getFile());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -