"I want to get object or more specifically access to methods in my JDialog class"
If the method getDialog
returns a standard JDialog
,
public JDialog getDialog(...) {}
Then you're stuck with the methods of JDialog
, without proper casting, or changing the return type. That would explain why you are able to setVisible
in the first method, because JDialog
does have a method setVisible
. So to access the method myMethod
you'll want to do some casting.
((MyDialog)mainFrame.getDialog(TABLECOUNTER)).myMethod();