2

NetBeansを使用して作成したJavaデスクトップアプリがあります。私がしたことは、ウィンドウが閉じてトレイに最小化するのを聞くことです。myApp.javaに、ウィンドウを閉じてからmyAppViewを非表示にするスタートアップメソッドのリスナーを追加しました。

タスクバーでアイコントレイを作成し、以前と同じフレームを開きたいもの。appViewをグローバル変数として宣言しましたが、静的と表示されるのでshow(myapp)を実行できます。これを機能させる方法はありますか?

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);
}
4

0 に答える 0