2

I have a java desktop app I made writing with netbeans. What I did is to listen to windows close and minimize to the tray. I added to myApp.java a listener on startup method that listen to window close and then hide the myAppView.

The thing I created a icontray in taskbar and I want to open same frame I had before. I declared the appView as global variable but can do show(myapp) cause it says its static. any idea how to get this to work?

public class myApp extends SingleFrameApplication {
    private myAppView mainv;


    @Override protected void startup() {
        mainv=new myAppView(this);
        show(mainv);
        addExitListener(new ExitListener() {

           public boolean canExit( EventObject event ) {
              systray();
              hide(mainv);

              return false;
           }

        public void willExit( EventObject arg0 ) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
}

/**
 * This method is to initialize the specified window by injecting resources.
 * Windows shown in our application come fully initialized from the GUI
 * builder, so this additional configuration is not needed.
 */
@Override protected void configureWindow(java.awt.Window root) {

}

/**
 * A convenient static getter for the application instance.
 * @return the instance of find4me
 */
public static myApp getApplication() {
    return Application.getInstance(myApp.class);
}

/**
 * Main method launching the application.
 */
public static void main(String[] args) {
    launch(myApp.class, args);
}
trashgod
  • 196,350
  • 25
  • 213
  • 918
m_itai
  • 51
  • 2
  • Hopefully this [answer](http://stackoverflow.com/a/8909348/1057230) by @MohammedFaisal will surely help you in your endeavour :-) – nIcE cOw Apr 12 '12 at 08:02
  • what im hiding is not a frame its the mainView – m_itai Apr 12 '12 at 08:04
  • It's tough to understand, exactly what this `mainView` is meant to do, May you point an [Short Compilable form](http://sscce.org/) of your code, that will be much appreciated. – nIcE cOw Apr 12 '12 at 08:08
  • So what does show and hide do? What is mainView? There isn't enough info to really be able to help – MadProgrammer Jul 11 '12 at 00:56

0 Answers0