如何从JinternalFrame调用jdialog [英] How to call a jdialog from a jinternalframe
问题描述
我有一个内部框架,我想创建一个内瓣
I have an internalframe, i want to create an evenet
private void errorTableMouseClicked(java.awt.event.MouseEvent evt) {
PaneDialog dlg = new PaneDialog(**this**,true);
}
现在PaneDialog是JDialog,我不能将构造函数"this"放在"this"是InternalFrame上,因此Netbeans显示错误的不兼容类型,PaneDiaglog无法转换为Frame,我如何在Internalframe中调用JDialog?>
now the PaneDialog is an JDialog, i cant put the constructor "this" cus "this" is InternalFrame so Netbeans shows an error incompatible types, PaneDiaglog can not be converted to Frame, how i call the JDialog in internalframe?
推荐答案
也许您可以使用JOptionPane.showInternal???(...)
方法之一,因为它们只需要将Component指定为父级即可.
Maybe you can use one of the JOptionPane.showInternal???(...)
methods since they only need a Component to be specified as the parent.
或者,如果要获取当前内部框架的JFrame,则可以使用:
Or if you want to get the JFrame for the current internal frame then you can use:
Window window = SwingUtilities.windowForComponent(...);
然后将窗口投射到JFrame.
and then cast the window to a JFrame.
这篇关于如何从JinternalFrame调用jdialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!