Shikhar13 / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

dialog.showPacked(BorderLayout.CENTER, true); not possible in GUI Builder application #235

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have a dialog, looking at properties there is no option to do 
dialog.showPacked(BorderLayout.CENTER, true);

Original issue reported on code.google.com by jkoo...@gmail.com on 29 Jun 2012 at 12:16

GoogleCodeExporter commented 9 years ago
That makes sense, showPacked() is not a property, it's a convenience function.  
You can get the behaviour you're looking for by overriding the component 
factory in your state machine:

    protected Component createComponentInstance(String componentType, Class cls) {
        if (cls == Dialog.class) {
            Dialog d = new Dialog() {
                public void show() {
                    System.out.println("custom show() called");
                    super.showPacked(BorderLayout.CENTER, true);
                }

            };
            return d;
        }
        return super.createComponentInstance(componentType, cls);
    }

Original comment by 1815...@coolman.ca on 29 Jun 2012 at 4:03

GoogleCodeExporter commented 9 years ago
That is supported globally through the theme constant: dialogPosition
For a specific dialog you can use the method Eric described.

Original comment by shai.almog on 29 Jun 2012 at 6:13