import org.apache.pivot.collections.Map;
import org.apache.pivot.wtk.*;

public class App implements Application {
    @Override
    public void startup(Display display, Map<String, String> stringStringMap) 
throws Exception {
        window = new Frame();
        window.setMaximized(true);
        window.setTitle("Pivot");

        window.getWindowStateListeners().add(new WindowStateListener.Adapter(){
            @Override
            public void windowOpened(Window window) {
                Dialog dialog = new Dialog();
                dialog.open(window);
            }
        });

        window.open(display);
    }

    @Override
    public boolean shutdown(boolean value) throws Exception {
        if (window != null)
            window.close();

        return false;
    }

    @Override
    public void suspend() throws Exception {
    }

    @Override
    public void resume() throws Exception {
    }

    public static void main(String[] args) {
        DesktopApplicationContext.main(App.class, args);
    }

    private Window window;
}


--- On Thu, 8/25/11, Chris Bartlett <[email protected]> wrote:

> From: Chris Bartlett <[email protected]>
> Subject: Re: Center Dialog in Window
> To: [email protected]
> Date: Thursday, August 25, 2011, 1:56 AM
> Denis,
> 
> Have you seen this tutorial?
> http://pivot.apache.org/tutorials/windows.html
> 
> It shows how to open Frames, Alerts, Dialogs,Prompts &
> Sheets, and how
> to position Windows with
> http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Component.html#setLocation(int,
> int)
> 
> The source is available here.
> http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/
> 
> On 25 August 2011 13:07, Denis Kononenko <[email protected]>
> wrote:
> > How open Dialog in center after opened main Window?
> >
> > Thanks
> >
> 

Reply via email to