声明java.awt.FileDialog中时出错 [英] Error when declaring java.awt.FileDialog

查看:149
本文介绍了声明java.awt.FileDialog中时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的code申报java.awt.FileDialog中的:

I'm trying to declare a java.awt.FileDialog in my code:

FileDialog save = new FileDialog(null, "Save file", FileDialog.SAVE);

但我得到了我的控制台下面的错误,当我尝试运行我的code:

But I get the following error in my console when I try to run my code:

构造的FileDialog(帧,字符串,INT)是模糊

任何人都知道我做错了?

Anyone know what I am doing wrong?

推荐答案

有2构造函数的 FileDialog的与3个参数。因为你传递null作为第一个参数,编译器无法区分你想要的构造函数。

There are 2 constructors for FileDialog with 3 arguments. Because you passed null as the first argument, the compiler cannot distinguish which constructor you want.

FileDialog(Dialog parent, String title, int mode)

FileDialog(Frame parent, String title, int mode)

您可以使用:

Frame frame = null;
FileDialog save = new FileDialog(frame, "Save file", FileDialog.SAVE);

修复。

这篇关于声明java.awt.FileDialog中时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆