How to call a jdialog from a jinternalframe

最后都变了- 提交于 2019-12-11 13:17:47

问题


I have an internalframe, i want to create an evenet

 private void errorTableMouseClicked(java.awt.event.MouseEvent evt) {                                          

    PaneDialog dlg = new PaneDialog(**this**,true);
  }

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?


回答1:


Maybe you can use one of the JOptionPane.showInternal???(...) methods since they only need a Component to be specified as the parent.

Or if you want to get the JFrame for the current internal frame then you can use:

Window window = SwingUtilities.windowForComponent(...);

and then cast the window to a JFrame.



来源:https://stackoverflow.com/questions/23109192/how-to-call-a-jdialog-from-a-jinternalframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!