Post

2 followers Follow
0
Avatar

How to display another Options Panel or any sorts of pop up in performOperation?

I'm trying to display a set of data fetched after clicking "Ok" in an Options panel. What should I implement in performOperation in order for me to display another pop up/Option panel?

Mark Miller

Please sign in to leave a comment.

7 comments

0
Avatar

Do your data fetching at the start of the performOperation method then use Dialogs.showDialog(...) to display the results. By default, this will cause the perform operation method to wait until the user closes the dialog then it will continue.

Richard Moir 0 votes
Comment actions Permalink
0
Avatar

That's displaying the retrieved data in a dialogue pop up right? Is there a way to display a JPanel that I designed myself.

Mark Miller 0 votes
Comment actions Permalink
0
Avatar

Yes, the message parameter to Dialogs.showDialog is type Object. You can pass any JComponent in as the message and it will be displayed.

Richard Moir 0 votes
Comment actions Permalink
0
Avatar

I read the documentations for Dialogs and tried to implement what you suggested, but I kept on getting errors because I wasn't passing in the correct parameters. Would I have to create a DialogOptions Object to use this method? Or can I just use Options? Please see the attachments for the code that I'm working with.




Screen Shot 2015-12-18 at 3.20.38 PM.png
Screen Shot 2015-12-18 at 3.20.05 PM.png
Mark Miller 0 votes
Comment actions Permalink
0
Avatar

It looks like your DisplayGUIModel class could just extend JPanel directly, assuming it isn't being passed to Geneious as an options somewhere. There is no need to extend options otherwise.

Then you can display it like this:

DialogOptions dialogOptions = new DialogOptions(Dialogs.OK_CANCEL, "");
Dialogs.showDialog(dialogOptions, displayGuiModel);

If you do need to extend Options then you can display it using Dialogs.showOptionsDialog() instead. This method is trickier to use though because you need to invoke it on the event dispatch thread.

Richard Moir 0 votes
Comment actions Permalink