filedialogdemo.java.bak

来自「java经典的源代码 我非常喜欢这个源代码 对于编程很有好处」· BAK 代码 · 共 40 行

BAK
40
字号
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
public class FileDialogDemo extends Frame
{
private JPanel contentPane;
  private XYLayout xYLayout1 = new XYLayout();
  private Button button1 = new Button("显示文件对话框");
  private FileDialog d=new FileDialog(this,"打开文件");
  //Construct the frame
  public FileDialogDemo() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    contentPane.setLayout(xYLayout1);
    this.setSize(new Dimension(400, 300));
    this.setTitle("Frame Title");
    button1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        button1_actionPerformed(e);
      }
    });
    contentPane.add(button1, new XYConstraints(114, 73, 125, 35));
  }
  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
    }
  }

  void button1_actionPerformed(ActionEvent e) {
    d.show();
  }

  public static void main(String args[]){
    FileDialogDemo f=new FileDialogDemo();
    f.show();
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?