filedialogexample.java~1~
来自「清华大学辛运帏java程序设计第二版源代码」· JAVA~1~ 代码 · 共 37 行
JAVA~1~
37 行
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 + =
减小字号Ctrl + -
显示快捷键?