extraguidemo5.java
来自「JAVA程序设计课程中各章节的程序实例。」· Java 代码 · 共 38 行
JAVA
38 行
/**
*A file dialog demonstration program
*FileDialog provides a basic file open/save dialog box that enables accessibility
* to the file system.The FileDialog is system-independent,but depending on the
* platform,the standard open/save dialog is brought up
*Steps to create a FileDialog:
*1.using the following constructor:
FileDialog(Frame,String,int)
The int argument specifies the mode,i.e.either FileDialog.LOAD for file open
or FileDialog.SAVE for file save.
*2.Create an instance of FileDialog class
*3.use the show() method to display it.
*2005.1.11. xhcprince
*/
import java.awt.*;
public class extraGUIDemo5
{
public static void main(String args[])
{
Myframe f = new Myframe("My window");
f.setVisible(true);
f.setSize(400,300);
FileDialog fd = new FileDialog(f,"open",FileDialog.LOAD);
fd.show();
// fd.setVisible(true);it's right too!
}
}
class Myframe extends Frame
{
Myframe(String name)
{
super(name);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?