Hints on using DialogWrapper?

Hi,

I was wondering if anybody had any hints on how to use
com.intellij.openapi.ui.DialogWrapper?

I've subclassed it, implemented my constructor to call the
DialogWrapper(Project, boolean) constructor, implemented
createCenterPanel and overidden doOKAction to copy textfield values into
fields for external access and then call super.doOKAction. But when I
instantiate it and call show(), it just appears as a very small window
in the center of the screen and even if I resize it there are no controls.

Thanks,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://java.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: 416-643-4846 | Fax: 416-594-1919

2 comments

Hi Gordon,

You can get an hint from an other plugin sources. I just released the sources for my J2MeSupport: http://www.intellij.org/twiki/bin/view/Main/JtoMESupport

In short you have to call DialogWrapper's

method (best done from constructor) and also
implement

if you want to add more or change existing dialog actions.

The last thing should be implementing

, where you have to create a panel (surprise :)), which is used as center pane for the dialog i.e.

Youd should also set the size of the center panel, which will resize your dialog.

Regards,

Pavlin

0

Gordon Tyler wrote:

I was wondering if anybody had any hints on how to use
com.intellij.openapi.ui.DialogWrapper?

I've subclassed it, implemented my constructor to call the
DialogWrapper(Project, boolean) constructor, implemented
createCenterPanel and overidden doOKAction to copy textfield values into
fields for external access and then call super.doOKAction. But when I
instantiate it and call show(), it just appears as a very small window
in the center of the screen and even if I resize it there are no controls.


To anwer my own question: Call init() in your subclass' constructor.

Additionally, I was having hassles trying to get my first textfield
focused. I eventually noticed the getPreferredFocusedComponent method
which you can override to return whichever component you want to get
focus first.

Ciao,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://java.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: 416-643-4846 | Fax: 416-594-1919

0

Please sign in to leave a comment.