How to call a jdialog from a jinternalframe

2019-07-23 15:31发布

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条回答
Evening l夕情丶
2楼-- · 2019-07-23 15:56

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.

查看更多
登录 后发表回答