做的一个简单的文本编辑器,字体控件点击的时候总是报异常

来源:百度知道 编辑:UC知道 时间:2024/05/25 03:33:03
我是初学者,做一个简单的文本编辑,导入的是import com.borland.dbswing.FontChooser;
菜单里面字体选项的点击事件是:
public void mnuFont_actionPerformed(ActionEvent e) {
fntSelect.showDialog();
if (fntSelect.showDialog()){
txaDisplay.setFont(fntSelect.getSelectedFont());
}
}

我运行的时候其他功能正常(颜色选择等),但是点字体就出现:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Frame property must be set before showing dialog
at com.borland.dbswing.FontChooser.showDialog(FontChooser.java:287)
at notepad.EditorFrame.mnuFont_actionPerformed(EditorFrame.java:126)
at notepad.EditorFrame_mnuFont_actionAdapter.actionPerformed(EditorFrame.java:181)
………………………… (下面一大串这样的错误行提示)

请问是怎么回事?

错误提示是 框架属性必须在显示之前设置 你看你的对话框是不是有什么属性没有设置啊

好好读1下你的错误报告就行了.

我没有用过这个类
是不是在显示之前需要进行设置啊,
去参考一下Demo