user3378888
user3378888

Reputation: 31

SWT: catch event shell to full-screen mode

How can I catch set full-screen mode event? SWT.Resize does not catch this event.

thanks.

Upvotes: 1

Views: 1090

Answers (1)

Baz
Baz

Reputation: 36884

I don't know why you're saying that SWT.Resize doesn't work, this works just fine:

public static void main(String[] args)
{
    final Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    shell.setText("StackOverflow");

    shell.addListener(SWT.Resize, new Listener()
    {
        @Override
        public void handleEvent(Event arg0)
        {
            if(shell.getMaximized())
                System.out.println("Maximize");
        }
    });

    shell.pack();
    shell.open();

    while (!shell.isDisposed())
    {
        if (!display.readAndDispatch())
        {
            display.sleep();
        }
    }
    display.dispose();
}

Upvotes: 2

Related Questions