问题
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