2024年6月3日发(作者:)

import .*;

import Event;

import Listener;

import Adapter;

import Event;

import .*;

public class app

{

Frame f = new Frame("我的文件");

FileDialog d1 = new FileDialog(f , "选择需要打开文件" , FileDialog.

LOAD

);

FileDialog d2 = new FileDialog(f , "选择保存文件的路径" , FileDialog.

SAVE

);

Button ok = new Button("打开");

Button ok1 = new Button("保存");

List colorList = new List(6, true);

TextArea ta = new TextArea(5, 20);

TextField name = new TextField(50);

public void init()

{

ionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{ ible(true);// 打印出用户选择的文件路径和文件名

System.

out

.println(ectory() + e());

}

});

ionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

ible(true);// 打印出用户选择的文件路径和文件名

System.

out

.println(ectory() + e());

}

});

Panel bottom = new Panel();

(name);

(ok);

(ok1);

(bottom , BorderLayout.

SOUTH

);

Box top = Box.

createHorizontalBox

();

(colorList);

dowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.

out

.println("用户试图关闭窗口!n");

System.

exit

(0);

}

});

(top);

();

ible(true);

}

public static void main(String[] args)

{

new app().init();

}

}