You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Daniel Iwan GM <iw...@googlemail.com> on 2010/03/07 17:03:36 UTC

Hide & show main window

I would like to hide / show main frame of the application created with
DesktopApplicationContext.main(HelloWTKX.class, args);
Basically it's because I want to keep it in system tray.

window.setVisible(false)

hides only the content of the window while
window.getParent.setVisible(false)
display message

Exception in thread "main" java.lang.UnsupportedOperationException: Can't
change the visibility of the display.
    at org.apache.pivot.wtk.Display.setVisible(Unknown Source)
    at com.daniel.iwan.nmtfeeder.gui.pivot.HelloWTKX.main(HelloWTKX.java:64)

Thanks

Re: Hide & show main window

Posted by Greg Brown <gk...@mac.com>.
There is currently no API to do this directly, but you can get a reference to the native host frame as follows:

java.awt.Frame hostFrame = (java.awt.Frame)display.getDisplayHost().getParent();

You can then set the visibility of this frame to hide the entire application.


On Mar 7, 2010, at 11:03 AM, Daniel Iwan GM wrote:

> I would like to hide / show main frame of the application created with
> DesktopApplicationContext.main(HelloWTKX.class, args);
> Basically it's because I want to keep it in system tray.
> 
> window.setVisible(false)
>  
> hides only the content of the window while window.getParent.setVisible(false)
> display message
> 
> Exception in thread "main" java.lang.UnsupportedOperationException: Can't change the visibility of the display.
>     at org.apache.pivot.wtk.Display.setVisible(Unknown Source)
>     at com.daniel.iwan.nmtfeeder.gui.pivot.HelloWTKX.main(HelloWTKX.java:64)
> 
> Thanks