XEiJApplet.java
     1: //========================================================================================
     2: //  XEiJApplet.java
     3: //    en:XEiJ applet
     4: //    ja:XEiJアプレット
     5: //  Copyright (C) 2003-2017 Makoto Kamada
     6: //
     7: //  This file is part of the XEiJ (X68000 Emulator in Java).
     8: //  You can use, modify and redistribute the XEiJ if the conditions are met.
     9: //  Read the XEiJ License for more details.
    10: //  http://stdkmd.com/xeij/
    11: //========================================================================================
    12: 
    13: //----------------------------------------------------------------------------------------
    14: //  LiveConnectを使用する
    15: //  参考
    16: //    http://docs.oracle.com/javase/jp/6/technotes/guides/jweb/applet/liveconnect_support.html
    17: //    https://developer.mozilla.org/ja/docs/Web/JavaScript/Guide/LiveConnect_Overview
    18: //    https://developer.mozilla.org/en-US/docs/Archive/Web/LiveConnect/LiveConnect_Reference
    19: //    http://docs.oracle.com/javase/jp/7/technotes/guides/jweb/index.html
    20: //----------------------------------------------------------------------------------------
    21: 
    22: package xeij;
    23: 
    24: import java.awt.*;  //BasicStroke,BorderLayout,BoxLayout,Color,Component,Container,Cursor,Desktop,Dimension,Font,Frame,Graphics,Graphics2D,GraphicsDevice,GraphicsEnvironment,GridLayout,Image,Insets,Paint,Point,Rectangle,RenderingHints,Robot,Shape,Stroke,TexturePaint,Toolkit
    25: import java.lang.*;  //Boolean,Character,Class,Comparable,Double,Exception,Float,IllegalArgumentException,Integer,Long,Math,Number,Object,Runnable,SecurityException,String,StringBuilder,System
    26: import javax.swing.*;  //AbstractSpinnerModel,Box,ButtonGroup,DefaultListModel,ImageIcon,JApplet,JButton,JCheckBox,JCheckBoxMenuItem,JDialog,JFileChooser,JFrame,JLabel,JList,JMenu,JMenuBar,JMenuItem,JPanel,JRadioButton,JScrollPane,JSpinner,JTextArea,JTextField,JTextPane,JViewport,ScrollPaneConstants,SpinnerListModel,SpinnerNumberModel,SwingConstants,SwingUtilities,UIManager,UIDefaults,UnsupportedLookAndFeelException
    27: import netscape.javascript.*;  //JSException,JSObject。jfxrt.jarではなくplugin.jarを使うこと
    28: 
    29: //$$XEA XEiJアプレット
    30: //  アプレットクラス
    31: public class XEiJApplet extends JApplet {
    32: 
    33:   public static final boolean APP_DEBUG_TRACE = false;
    34: 
    35:   public static XEiJApplet appApplet;  //アプレット
    36:   public static boolean appLiveConnectSupported;  //true=LiveConnectが動作する
    37:   public static JSObject appWindow;  //window
    38:   public static JSObject appDocument;  //document
    39:   public static JSObject appDocumentBody;  //document.body
    40:   public static JSObject appDocumentElement;  //document.documentElement
    41:   public static String appElementId;  //<object>または<applet>のid
    42:   public static int appWidth;  //アプレットの要素の現在のサイズ
    43:   public static int appHeight;
    44:   public static int appMinWidth;  //アプレットの要素の最小サイズ。ウインドウに合わせるときこれより小さくしない
    45:   public static int appMinHeight;
    46:   public static boolean appFullscreenOn;  //true=全画面表示
    47:   public static boolean appFitInWindowOn;  //true=ウインドウに合わせる
    48:   public static JSObject appDeckElement;  //デッキ。外側のdiv要素。document.bodyと一緒に動く
    49:   public static JSObject appLiftElement;  //リフト。内側のdiv要素。ウインドウに合わせるときデッキからはみ出してウインドウ一杯に広がる。全画面表示のときフルスクリーンになる
    50:   public static JSObject appElement;  //アプレットの要素。object要素またはapplet要素またはembed要素
    51:   public static JSObject appRequestDialog;  //全画面表示のダイアログ
    52:   public static JSObject appExitDialog;  //全画面解除のダイアログ
    53:   public static JSObject appYesButton;  //Yesボタン
    54:   public static JSObject appNoButton;  //Noボタン
    55:   public static JSObject appOkButton;  //Okボタン
    56:   public static String appRequestFullscreenMethod;  //lift.requestFullscreen相当のメソッド名
    57:   public static String appExitFullscreenMethod;  //document.exitFullscreen相当のメソッド名
    58:   public static String appFullscreenElementField;  //document.fullscreenElement相当のフィールド名
    59:   public static boolean appIsMSIE;  //true=IE11
    60:   public static boolean appIsChrome;  //true=Chrome
    61:   public static int appLiftLeft;  //appLiftElementの相対位置
    62:   public static int appLiftTop;
    63:   public static int appPrevLiftLeft;  //全画面表示に移行する前のappLiftElementの相対位置
    64:   public static int appPrevLiftTop;
    65: 
    66:   //appInit ()
    67:   //  初期化
    68:   public static void appInit () {
    69:     if (APP_DEBUG_TRACE) {
    70:       System.out.println ("appInit()");
    71:     }
    72:     appLiveConnectSupported = false;
    73:     XEiJ.pnlIsFullscreenSupported = false;
    74:     XEiJ.pnlIsFitInWindowSupported = false;
    75:     //LiveConnect
    76:     try {
    77:       appWindow = JSObject.getWindow (appApplet);  //windowオブジェクト
    78:       appDocument = appGetJSObject (appWindow, "document");
    79:       if (appDocument != null) {
    80:         appElementId = appApplet.getParameter ("elementid");
    81:         if (appElementId == null) {
    82:           appElementId = "XEiJApplet";
    83:         }
    84:         if (APP_DEBUG_TRACE) {
    85:           System.out.println ("appElementId = " + appElementId);
    86:         }
    87:         appElement = appCallJSObject (appDocument, "getElementById", appElementId);
    88:         if (APP_DEBUG_TRACE) {
    89:           System.out.println ("appElement = " + appElement);
    90:         }
    91:         if (appElement != null) {
    92:           //appAttr (appElement, "mayscript", true);
    93:           appLiftElement = appGetJSObject (appElement, "parentNode");
    94:           if (APP_DEBUG_TRACE) {
    95:             System.out.println ("appLiftElement = " + appLiftElement);
    96:           }
    97:           if (appLiftElement != null && "div".equalsIgnoreCase (appGetString (appLiftElement, "tagName"))) {
    98:             appDeckElement = appGetJSObject (appLiftElement, "parentNode");
    99:             if (APP_DEBUG_TRACE) {
   100:               System.out.println ("appDeckElement = " + appDeckElement);
   101:             }
   102:             if (appDeckElement != null && "div".equalsIgnoreCase (appGetString (appDeckElement, "tagName"))) {
   103:               appLiveConnectSupported = "XEiJAppletOuter".equals (appElementId);
   104:             }
   105:           }
   106:         }
   107:       }
   108:     } catch (Exception e) {
   109:       //Operaのときローカルでは
   110:       //  netscape.javascript.JSException: baseURI and docbase host DO NOT match: localhost
   111:       //というエラーが出る
   112:       if (APP_DEBUG_TRACE) {
   113:         e.printStackTrace ();
   114:       }
   115:     }
   116:     if (APP_DEBUG_TRACE) {
   117:       System.out.println ("appLiveConnectSupported = " + appLiveConnectSupported);
   118:     }
   119:     if (appLiveConnectSupported) {
   120:       appDocumentBody = appGetJSObject (appDocument, "body");
   121:       appDocumentElement = appGetJSObject (appDocument, "documentElement");
   122:       appWidth = 768;
   123:       appHeight = 639;
   124:       appMinWidth = 200;
   125:       appMinHeight = 200;
   126:       appFullscreenOn = false;
   127:       appFitInWindowOn = false;
   128:       appStyle (appDeckElement,
   129:                 "left", "0px",
   130:                 "position", "relative",
   131:                 "top", "0px");
   132:       appLiftLeft = 0;
   133:       appLiftTop = 0;
   134:       String color2 = XEiJ.fmtHex6 (new StringBuilder ().append ('#'), LnF.LNF_RGB[2]).toString ();
   135:       appStyle (appLiftElement,
   136:                 //"backgroundColor", color2,  //ウインドウに合わせるときリフトがデッキからはみ出した部分にダイアログを表示したとき奥のテキストが見えないようにする
   137:                 "left", "0px",
   138:                 "position", "relative",
   139:                 //"textAlign", "center",  //HTMLに書いておかないと起動するまで左に寄ったままになる
   140:                 "top", "0px",
   141:                 "zIndex", "65535");
   142:       appStyle (appElement,
   143:                 "height", appHeight + "px",
   144:                 //"margin", "0px 0px",  //auto 0px
   145:                 "position", "relative",
   146:                 "width", appWidth + "px");
   147:       XEiJ.pnlIsFullscreenSupported = false;
   148:       String userAgent = appGetString (appGetJSObject (appWindow, "navigator"), "userAgent");
   149:       if (userAgent != null) {
   150:         appIsMSIE = userAgent.indexOf ("Trident") >= 0;  //IE11
   151:         appIsChrome = userAgent.indexOf ("Chrome") >= 0;  //Chrome
   152:         //Chromeのバグ対策
   153:         //  ウインドウの上部に表示されるJavaアプレットの実行の許可を求めるバーが引っ込む前にアプレットが表示されたとき、
   154:         //  アプレットの位置が下にずれたまま起動してしまう
   155:         //  ずれているだけならまだよいのだが、マウスに反応しないのでメニューを操作できない
   156:         //  ウインドウの枠を摘んでちょっとリサイズしてやるだけでアプレットがガクンと跳ね上がって本来の位置に収まって操作できるようになるが、
   157:         //  分かりにくいのでデッキを1pxだけずらすことで人間が操作しなくても本来の位置(+1px)に戻るようにする
   158:         //  すぐに0pxに戻してしまうと効果がない
   159:         //  時間を開ければよいのだろうが面倒なので1pxずれたままにする
   160:         //if (appIsChrome) {  //Chromeのとき → Chrome以外でもずらしてみる
   161:         appStyle (appDeckElement,
   162:                   "top", "1px");
   163:         //}
   164:         if (true) {
   165:           //全画面API
   166:           //  https://msdn.microsoft.com/library/dn265028(v=vs.85).aspx
   167:           appRequestFullscreenMethod = null;
   168:           appExitFullscreenMethod = null;
   169:           appFullscreenElementField = null;
   170:           for (String candidate : new String[] {
   171:             "msRequestFullscreen",  //IE。screenのsは小文字
   172:             "webkitRequestFullScreen",  //Chrome。ScreenのSは大文字と小文字の両方
   173:             "mozRequestFullScreen",  //Firefox,Waterfox。ScreenのSは大文字
   174:             "requestFullscreen",  //HTML5,Chrome,Firefox,Opera,Waterfox。screenは小文字
   175:           }) {
   176:             if (appIsDefined (appLiftElement, candidate)) {
   177:               appRequestFullscreenMethod = candidate;
   178:               if (APP_DEBUG_TRACE) {
   179:                 System.out.println ("requestFullscreen = " + candidate);
   180:               }
   181:               break;
   182:             }
   183:           }
   184:           for (String candidate : new String[] {
   185:             "msExitFullscreen",  //IE。screenのsは小文字
   186:             "webkitCancelFullScreen",  //Chrome。ScreenのSは大文字
   187:             "mozCancelFullScreen",  //Firefox,Waterfox。ScreenのSは大文字
   188:             "exitFullscreen",  //HTML5,Chrome,Opera,Waterfox。screenは小文字
   189:           }) {
   190:             if (appIsDefined (appDocument, candidate)) {
   191:               appExitFullscreenMethod = candidate;
   192:               if (APP_DEBUG_TRACE) {
   193:                 System.out.println ("exitFullscreen = " + candidate);
   194:               }
   195:               break;
   196:             }
   197:           }
   198:           for (String candidate : new String[] {
   199:             "msFullscreenElement",  //IE。screenは小文字
   200:             "webkitFullscreenElement",  //Chrome。screenは小文字
   201:             "mozFullScreenElement",  //Firefox。ScreenのSは大文字
   202:             //"webkitCurrentFullScreenElement",  //Chrome。ScreenのSは大文字
   203:             "fullscreenElement",  //HTML5,Opera。screenは小文字
   204:           }) {
   205:             if (appIsDefined (appDocument, candidate)) {
   206:               appFullscreenElementField = candidate;
   207:               if (APP_DEBUG_TRACE) {
   208:                 System.out.println ("fullscreenElement = " + candidate);
   209:               }
   210:               break;
   211:             }
   212:           }
   213:           XEiJ.pnlIsFullscreenSupported = appRequestFullscreenMethod != null && appExitFullscreenMethod != null;  //全画面表示に移行できる
   214:         }  //IE11またはChromeのとき
   215:       }  //if userAgent!=null
   216:       XEiJ.pnlIsFitInWindowSupported = true;  //LiveConnectが動作しているのでウインドウに合わせられる
   217:       appEvent (appWindow, "resize", appElementId + ".appWindowOnresize ();");
   218:       appRequestDialog = null;  //使うときに作る
   219:     }  //if appLiveConnectSupported
   220:   }  //appInit()
   221: 
   222:   //appMake ()
   223:   //  アプレットのメニューとコンテントペインを設定する
   224:   public static void appMake () {
   225:     if (APP_DEBUG_TRACE) {
   226:       System.out.println ("appMake()");
   227:     }
   228:     appApplet.setJMenuBar (XEiJ.mnbMenuBar);
   229:     appApplet.getContentPane ().add (XEiJ.pnlPanel, BorderLayout.CENTER);
   230:   }  //appMake()
   231: 
   232:   //appMakeRequestDialog ()
   233:   //  全画面表示のダイアログを作る
   234:   public static void appMakeRequestDialog () {
   235:     if (APP_DEBUG_TRACE) {
   236:       System.out.println ("appMakeRequestDialog()");
   237:     }
   238:     if (appRequestDialog == null) {
   239:       appRequestDialog = appCreate ("div");  //ダイアログ
   240:       String color2 = XEiJ.fmtHex6 (new StringBuilder ().append ('#'), LnF.LNF_RGB[2]).toString ();
   241:       if (false) {
   242:         appStyle (appRequestDialog,
   243:                   "backgroundColor", color2,
   244:                   "border", "#ff0 solid 0.125em",
   245:                   "borderRadius", "0.5em",
   246:                   "display", "none",  //まだ表示しない
   247:                   "margin", "0.5em auto",
   248:                   "padding", "0.5em",
   249:                   "textAlign", "center",
   250:                   "width", "400px");
   251:         appAppend (appRequestDialog,
   252:                    appText (Multilingual.mlnJapanese ? "全画面表示に切り替えますか? " : "Do you want to switch to full screen? "),
   253:                    appAppend (appEvent (appAttr (appYesButton = appCreate ("button"),
   254:                                                  "tabIndex", 1),
   255:                                         "click", appElementId + ".appRequestOnclick (true);"),
   256:                               appText (Multilingual.mlnJapanese ? " はい " : " Yes ")),  //Chromeのとき末尾の文字が化けるので空白を追加
   257:                    appText (" "),
   258:                    appAppend (appEvent (appAttr (appNoButton = appCreate ("button"),
   259:                                                  "tabIndex", 2),
   260:                                         "click", appElementId + ".appRequestOnclick (false);"),
   261:                               appText (Multilingual.mlnJapanese ? " いいえ " : " No ")));  //Chromeのとき末尾の文字が化けるので空白を追加
   262:       } else {
   263:         appAppend (appStyle (appRequestDialog,
   264:                              "backgroundColor", color2,
   265:                              "display", "none",  //まだ表示しない
   266:                              "margin", "0px",
   267:                              "padding", "0.5em 0px"),
   268:                    appAppend (appStyle (appCreate ("div"),
   269:                                         "border", "#ff0 solid 0.125em",
   270:                                         "borderRadius", "0.5em",
   271:                                         "margin", "0px auto",
   272:                                         "padding", "0.5em",
   273:                                         "textAlign", "center",
   274:                                         "width", "400px"),
   275:                               appText (Multilingual.mlnJapanese ? "全画面表示に切り替えますか? " : "Do you want to switch to full screen? "),
   276:                               appAppend (appEvent (appAttr (appYesButton = appCreate ("button"),
   277:                                                             "tabIndex", 1),
   278:                                                    "click", appElementId + ".appRequestOnclick (true);"),
   279:                                          appText (Multilingual.mlnJapanese ? " はい " : " Yes ")),  //Chromeのとき末尾の文字が化けるので空白を追加
   280:                               appText (" "),
   281:                               appAppend (appEvent (appAttr (appNoButton = appCreate ("button"),
   282:                                                             "tabIndex", 2),
   283:                                                    "click", appElementId + ".appRequestOnclick (false);"),
   284:                                          appText (Multilingual.mlnJapanese ? " いいえ " : " No "))));  //Chromeのとき末尾の文字が化けるので空白を追加
   285:       }
   286:       appCall (appLiftElement, "insertBefore", appRequestDialog, appElement);  //アプレットの上に押し込む
   287:     }
   288:   }  //appMakeRequestDialog()
   289: 
   290:   //appMakeExitDialog ()
   291:   //  全画面解除のダイアログを作る
   292:   public static void appMakeExitDialog () {
   293:     if (APP_DEBUG_TRACE) {
   294:       System.out.println ("appMakeExitDialog()");
   295:     }
   296:     if (appExitDialog == null) {
   297:       appExitDialog = appCreate ("div");  //ダイアログ
   298:       String color2 = XEiJ.fmtHex6 (new StringBuilder ().append ('#'), LnF.LNF_RGB[2]).toString ();
   299:       if (false) {
   300:         appStyle (appExitDialog,
   301:                   "backgroundColor", color2,
   302:                   "border", "#ff0 solid 0.125em",
   303:                   "borderRadius", "0.5em",
   304:                   "display", "none",  //まだ表示しない
   305:                   "margin", "0.5em auto",
   306:                   "padding", "0.5em",
   307:                   "textAlign", "center",
   308:                   "width", "400px");
   309:         appAppend (appExitDialog,
   310:                    appText (Multilingual.mlnJapanese ? "全画面表示を終了します " : "Exiting full screen mode "),
   311:                    appAppend (appEvent (appAttr (appOkButton = appCreate ("button"),
   312:                                                  "tabIndex", 1),
   313:                                         "click", appElementId + ".appExitOnclick (true);"),
   314:                               appText (" OK ")));  //Chromeのとき末尾の文字が化けるので空白を追加
   315:       } else {
   316:         appAppend (appStyle (appExitDialog,
   317:                              "backgroundColor", color2,
   318:                              "display", "none",  //まだ表示しない
   319:                              "margin", "0px",
   320:                              "padding", "0.5em 0px"),
   321:                    appAppend (appStyle (appCreate ("div"),
   322:                                         "border", "#ff0 solid 0.125em",
   323:                                         "borderRadius", "0.5em",
   324:                                         "margin", "0px auto",
   325:                                         "padding", "0.5em",
   326:                                         "textAlign", "center",
   327:                                         "width", "400px"),
   328:                               appText (Multilingual.mlnJapanese ? "全画面表示を終了します " : "Exiting full screen mode "),
   329:                               appAppend (appEvent (appAttr (appOkButton = appCreate ("button"),
   330:                                                             "tabIndex", 1),
   331:                                                    "click", appElementId + ".appExitOnclick (true);"),
   332:                                          appText (" OK "))));  //Chromeのとき末尾の文字が化けるので空白を追加
   333:       }
   334:       appCall (appLiftElement, "insertBefore", appExitDialog, appElement);  //アプレットの上に押し込む
   335:     }
   336:   }  //appMakeExitDialog()
   337: 
   338:   //appReload ()
   339:   //  設定に従ってコンポーネントを更新する
   340:   public static void appReload () {
   341:     if (APP_DEBUG_TRACE) {
   342:       System.out.println ("appReload()");
   343:     }
   344:     String color2 = XEiJ.fmtHex6 (new StringBuilder ().append ('#'), LnF.LNF_RGB[2]).toString ();
   345:     appStyle (appDocumentBody,
   346:               "backgroundColor", color2);
   347:     appStyle (appLiftElement,
   348:               "backgroundColor", color2);
   349:   }  //appReload()
   350: 
   351:   //appStandbyFullscreen (on)
   352:   //  全画面表示の設定の準備
   353:   //  OFF→ONのとき
   354:   //    requestFullscreenはマウスイベントまたはキーイベントの中でなければ動作しないので確認ダイアログを出してボタンを押してもらう
   355:   //    全画面表示の切り替えのインタフェイスをJavaScriptに渡す
   356:   //    キャンセルされる場合があるのでここではまだ全画面表示に移行しない
   357:   //    全画面表示メニューを無効にする
   358:   //      F11キーは全画面表示メニューが有効なときdoClick()しているだけなので全画面表示メニューを無効にすればF11キーも効かなくなる
   359:   //  ON→OFFのとき
   360:   //    MSIEまたはChromeのとき
   361:   //      全画面表示を解除する
   362:   //    それ以外
   363:   //      exitFullscreenはマウスイベントまたはキーイベントの中でなければ動作しないので確認ダイアログを出してボタンを押してもらう
   364:   //      全画面表示の切り替えのインタフェイスをJavaScriptに渡す
   365:   //      全画面表示メニューを無効にする
   366:   //        F11キーは全画面表示メニューが有効なときdoClick()しているだけなので全画面表示メニューを無効にすればF11キーも効かなくなる
   367:   public static void appStandbyFullscreen (boolean on) {
   368:     if (APP_DEBUG_TRACE) {
   369:       System.out.println ("appStandbyFullscreen(" + on + ")");
   370:     }
   371:     if (XEiJ.pnlIsFullscreenSupported && appFullscreenOn != on) {
   372:       if (on) {  //OFF→ON
   373:         XEiJ.mnbFullscreenMenuItem.setEnabled (false);  //全画面表示メニューを無効にする
   374:         appMakeRequestDialog ();  //appRequestDialogを作る
   375:         appStyle (appRequestDialog,
   376:                   "display", "block");  //ダイアログを表示する
   377:         appCall (appYesButton, "focus");  //Yesボタンにフォーカスを移す
   378:       } else if (appIsMSIE || appIsChrome) {  //ON→OFFかつMSIEまたはChrome
   379:         appSetFullscreenOn (false);  //全画面表示を解除する
   380:       } else {  //ON→OFFかつMSIEまたはChrome以外
   381:         XEiJ.mnbFullscreenMenuItem.setEnabled (false);  //全画面表示メニューを無効にする
   382:         appMakeExitDialog ();  //appExitDialogを作る
   383:         appStyle (appExitDialog,
   384:                   "display", "block");  //ダイアログを表示する
   385:         appCall (appOkButton, "focus");  //Okボタンにフォーカスを移す
   386:       }
   387:     }
   388:   }  //appStandbyFullscreen(boolean)
   389: 
   390:   //appSetFullscreenOn (on)
   391:   //  全画面表示を設定する
   392:   public static void appSetFullscreenOn (boolean on) {
   393:     if (APP_DEBUG_TRACE) {
   394:       System.out.println ("appSetFullscreenOn(" + on + ")");
   395:     }
   396:     if (XEiJ.pnlIsFullscreenSupported && appFullscreenOn != on) {
   397:       if (on) {  //OFF→ON
   398:         XEiJ.pnlFullscreenOn = true;
   399:         appFullscreenOn = true;
   400:         XEiJ.mnbFullscreenMenuItem.setSelected (true);  //全画面表示メニューを有効にする
   401:         if (false) {
   402:           appCall (appLiftElement, appRequestFullscreenMethod);  //全画面表示に移行する
   403:           XEiJ.pnlPrevFitInWindowOn = XEiJ.pnlFitInWindowOn;  //全画面表示に移行する前にウインドウに合わせていたか
   404:           XEiJ.pnlSetFitInWindowOn (true);  //ウインドウに合わせる
   405:         } else {
   406:           XEiJ.pnlPrevFitInWindowOn = XEiJ.pnlFitInWindowOn;  //全画面表示に移行する前にウインドウに合わせていたか
   407:           XEiJ.pnlSetFitInWindowOn (true);  //ウインドウに合わせる
   408:           appCall (appLiftElement, appRequestFullscreenMethod);  //全画面表示に移行する
   409:         }
   410:         appPrevLiftLeft = appLiftLeft;
   411:         appPrevLiftTop = appLiftTop;
   412:         appLiftLeft = 0;
   413:         appLiftTop = 0;
   414:         appStyle (appLiftElement,
   415:                   "left", "0px",
   416:                   "top", "0px");
   417:       } else {  //ON→OFF
   418:         XEiJ.pnlFullscreenOn = false;
   419:         appFullscreenOn = false;
   420:         appCall (appDocument, appExitFullscreenMethod);  //全画面表示を解除する
   421:         if (XEiJ.pnlPrevFitInWindowOn) {  //全画面表示に移行する前はウインドウに合わせていた
   422:           XEiJ.mnbFitInWindowMenuItem.setSelected (true);  //メニューだけ戻す
   423:           appLiftLeft = appPrevLiftLeft;
   424:           appLiftTop = appPrevLiftTop;
   425:           appStyle (appLiftElement,
   426:                     "left", appLiftLeft + "px",
   427:                     "top", appLiftTop + "px");
   428:         } else {  //全画面表示に移行する前はウインドウに合わせていなかった
   429:           XEiJ.pnlSetFitInWindowOn (false);  //ウインドウに合わせない
   430:         }
   431:       }
   432:     }
   433:   }  //appSetFullscreenOn(boolean)
   434: 
   435:   //appSetFitInWindowOn (on, width, height)
   436:   //  アプレットをウインドウに合わせるかどうかを設定する
   437:   //  一度documentに接続したアプレットは一瞬でもdocumentから切り離してはならない
   438:   //    appendChildなどでノードを繋ぎ直すのもダメ
   439:   //    style.positionをrelativeからabsoluteに変更するのもダメ
   440:   //  style.left,style.top,style.width,style.heightでレクタングルを変更するだけなら大丈夫
   441:   //    style.width,style.heightを0にするのはダメ
   442:   public static void appSetFitInWindowOn (boolean on, int width, int height) {
   443:     if (APP_DEBUG_TRACE) {
   444:       System.out.println ("appSetFitInWindowOn(" + on + "," + width + "," + height + ")");
   445:     }
   446:     if (XEiJ.pnlIsFitInWindowSupported && appFitInWindowOn != on) {
   447:       appFitInWindowOn = on;
   448:       if (on) {  //ウインドウに合わせる
   449:         appStyle (appDocumentBody,
   450:                   "overflow", "hidden");
   451:         appStyle (appElement,
   452:                   "margin", "0px 0px");
   453:         appLiftLeft = appGetDocumentScrollLeft () - appGetInt (appDeckElement, "offsetLeft");
   454:         appLiftTop = appGetDocumentScrollTop () - appGetInt (appDeckElement, "offsetTop");
   455:         appStyle (appLiftElement,
   456:                   "left", appLiftLeft + "px",
   457:                   "top", appLiftTop + "px");
   458:         appSetSize (appGetWindowInnerWidth (width),
   459:                     appGetWindowInnerHeight (height));
   460:       } else {  //ウインドウに合わせない
   461:         appSetSize (width, height);
   462:         //appStyle (appElement,
   463:         //          "margin", "0px 0px");  //0px auto
   464:         appLiftLeft = 0;
   465:         appLiftTop = 0;
   466:         appStyle (appLiftElement,
   467:                   "left", "0px",
   468:                   "top", "0px");
   469:         appStyle (appDocumentBody,
   470:                   "overflow", "auto");
   471:       }
   472:     }
   473:   }  //appSetFitInWindowOn(boolean,int,int)
   474: 
   475:   //appSetSize (width, height)
   476:   //  アプレットのサイズを設定する
   477:   //  最小サイズの制限は受けない
   478:   public static void appSetSize (int width, int height) {
   479:     if (APP_DEBUG_TRACE) {
   480:       System.out.println ("appSetSize(" + width + "," + height + ")");
   481:     }
   482:     if (appWidth != width || appHeight != height) {
   483:       appWidth = width;
   484:       appHeight = height;
   485:       appAttr (appElement,
   486:                "height", height + "",
   487:                "width", width + "");
   488:       appStyle (appElement,
   489:                 "height", height + "px",
   490:                 "width", width + "px");
   491:     }
   492:   }  //appSetSize(int,int)
   493: 
   494:   //appSetMinSize (minWidth, minHeight)
   495:   //  アプレットの最小サイズを設定する
   496:   //  現在のサイズが小さすぎるときは大きくする
   497:   //  ウインドウに合わせるときはウインドウを手動でリサイズしたときに小さくなり過ぎないようにする
   498:   public static void appSetMinSize (int minWidth, int minHeight) {
   499:     if (APP_DEBUG_TRACE) {
   500:       System.out.println ("appSetMinSize(" + minWidth + "," + minHeight + ")");
   501:     }
   502:     if (appMinWidth != minWidth || appMinHeight != minHeight) {
   503:       appMinWidth = minWidth;
   504:       appMinHeight = minHeight;
   505:       if (appWidth < minWidth || appHeight < minHeight) {
   506:         appSetSize (Math.max (minWidth, appWidth),
   507:                     Math.max (minHeight, appHeight));
   508:       }
   509:     }
   510:   }  //appSetMinSize(int,int)
   511: 
   512:   //i = appGetWindowInnerWidth (i0)
   513:   //  ウインドウの内側の幅を求める
   514:   //  取り出せないか0以下のときはi0を返す
   515:   public static int appGetWindowInnerWidth (int i0) {
   516:     if (APP_DEBUG_TRACE) {
   517:       System.out.println ("appGetWindowInnerWidth(" + i0 + ")");
   518:     }
   519:     if (true) {
   520:       int i = appGetInt (appWindow, "innerWidth");
   521:       if (i <= 0) {
   522:         i = appGetInt (appDocumentElement, "clientWidth");
   523:         if (i <= 0) {
   524:           i = appGetInt (appDocumentBody, "clientWidth");
   525:           if (i <= 0) {
   526:             i = i0;
   527:           }
   528:         }
   529:       }
   530:       return i;
   531:     } else {
   532:       return (appIsDefined (appWindow, "innerWidth") ? appGetInt (appWindow, "innerWidth") :
   533:               appIsDefined (appDocumentElement, "clientWidth") ? appGetInt (appDocumentElement, "clientWidth") :
   534:               appIsDefined (appDocumentBody, "clientWidth") ? appGetInt (appDocumentBody, "clientWidth") :
   535:               i0);
   536:     }
   537:   }  //appGetWindowInnerWidth(int)
   538: 
   539:   //i = appGetWindowInnerHeight (i0)
   540:   //  ウインドウの内側の高さを求める
   541:   //  取り出せないか0以下のときはi0を返す
   542:   public static int appGetWindowInnerHeight (int i0) {
   543:     if (APP_DEBUG_TRACE) {
   544:       System.out.println ("appGetWindowInnerHeight(" + i0 + ")");
   545:     }
   546:     if (true) {
   547:       int i = appGetInt (appWindow, "innerHeight");
   548:       if (i <= 0) {
   549:         i = appGetInt (appDocumentElement, "clientHeight");
   550:         if (i <= 0) {
   551:           i = appGetInt (appDocumentBody, "clientHeight");
   552:           if (i <= 0) {
   553:             i = i0;
   554:           }
   555:         }
   556:       }
   557:       if (APP_DEBUG_TRACE) {
   558:         System.out.println ("=" + i);
   559:       }
   560:       return i;
   561:     } else {
   562:       int i = (appIsDefined (appWindow, "innerHeight") ? appGetInt (appWindow, "innerHeight") :
   563:                appIsDefined (appDocumentElement, "clientHeight") ? appGetInt (appDocumentElement, "clientHeight") :
   564:                appIsDefined (appDocumentBody, "clientHeight") ? appGetInt (appDocumentBody, "clientHeight") :
   565:                i0);
   566:       if (APP_DEBUG_TRACE) {
   567:         System.out.println ("=" + i);
   568:       }
   569:       return i;
   570:     }
   571:   }  //appGetWindowInnerHeight(int)
   572: 
   573:   //i = appGetDocumentScrollLeft ()
   574:   //  ドキュメントのx方向のスクロール位置を求める
   575:   public static int appGetDocumentScrollLeft () {
   576:     if (APP_DEBUG_TRACE) {
   577:       System.out.println ("appGetDocumentScrollLeft()");
   578:     }
   579:     if (true) {
   580:       int i = appGetInt (appDocumentElement, "scrollLeft");
   581:       if (i == 0) {
   582:         i = appGetInt (appDocumentBody, "scrollLeft");
   583:       }
   584:       if (APP_DEBUG_TRACE) {
   585:         System.out.println ("=" + i);
   586:       }
   587:       return i;
   588:     } else {
   589:       int i = (appIsDefined (appDocumentElement, "scrollLeft") ? appGetInt (appDocumentElement, "scrollLeft") :
   590:                appIsDefined (appDocumentBody, "scrollLeft") ? appGetInt (appDocumentBody, "scrollLeft") :
   591:                0);
   592:       if (APP_DEBUG_TRACE) {
   593:         System.out.println ("=" + i);
   594:       }
   595:       return i;
   596:     }
   597:   }  //appGetDocumentScrollLeft()
   598: 
   599:   //i = appGetDocumentScrollTop ()
   600:   //  ドキュメントのy方向のスクロール位置を求める
   601:   public static int appGetDocumentScrollTop () {
   602:     if (APP_DEBUG_TRACE) {
   603:       System.out.println ("appGetDocumentScrollTop()");
   604:     }
   605:     if (true) {
   606:       int i = appGetInt (appDocumentElement, "scrollTop");
   607:       if (i == 0) {
   608:         i = appGetInt (appDocumentBody, "scrollTop");
   609:       }
   610:       if (APP_DEBUG_TRACE) {
   611:         System.out.println ("=" + i);
   612:       }
   613:       return i;
   614:     } else {
   615:       int i = (appIsDefined (appDocumentElement, "scrollTop") ? appGetInt (appDocumentElement, "scrollTop") :
   616:                appIsDefined (appDocumentBody, "scrollTop") ? appGetInt (appDocumentBody, "scrollTop") :
   617:                0);
   618:       if (APP_DEBUG_TRACE) {
   619:         System.out.println ("=" + i);
   620:       }
   621:       return i;
   622:     }
   623:   }  //appGetDocumentScrollTop()
   624: 
   625:   //r = appGetInt (o, m)
   626:   //  r=o.m
   627:   //  結果をintで返す
   628:   //  失敗したときは0を返す
   629:   //  try~catch~と(Number)とintValue()を書く手間を省く
   630:   public static int appGetInt (JSObject o, String m) {
   631:     if (APP_DEBUG_TRACE) {
   632:       System.out.println ("appGetInt(" + o + "," + m + ")");
   633:     }
   634:     int r = 0;
   635:     try {
   636:       r = ((Number) o.getMember (m)).intValue ();  //ChromeはDouble,IE11はInteger
   637:     } catch (Exception e) {  //NullPointerException | JSException | ClassCastException
   638:       if (APP_DEBUG_TRACE) {
   639:         e.printStackTrace ();
   640:       }
   641:     }
   642:     if (APP_DEBUG_TRACE) {
   643:       System.out.println ("=" + r);
   644:     }
   645:     return r;
   646:   }  //appGetInt(JSObject,String)
   647: 
   648:   //r = appGetString (o, m)
   649:   //  r=o.m
   650:   //  結果をStringで返す
   651:   //  失敗したときはnullを返す
   652:   //  try~catch~と(String)を書く手間を省く
   653:   public static String appGetString (JSObject o, String m) {
   654:     if (APP_DEBUG_TRACE) {
   655:       System.out.println ("appGetString(" + o + "," + m + ")");
   656:     }
   657:     String r = null;
   658:     try {
   659:       r = (String) o.getMember (m);
   660:     } catch (Exception e) {  //NullPointerException | JSException | ClassCastException
   661:       if (APP_DEBUG_TRACE) {
   662:         e.printStackTrace ();
   663:       }
   664:     }
   665:     if (APP_DEBUG_TRACE) {
   666:       System.out.println ("=" + r);
   667:     }
   668:     return r;
   669:   }  //appGetString(JSObject,String)
   670: 
   671:   //r = appGetJSObject (o, m)
   672:   //  r=o.m
   673:   //  結果をJSObjectで返す
   674:   //  失敗したときはnullを返す
   675:   //  try~catch~と(JSObject)を書く手間を省く
   676:   public static JSObject appGetJSObject (JSObject o, String m) {
   677:     if (APP_DEBUG_TRACE) {
   678:       System.out.println ("appGetJSObject(" + o + "," + m + ")");
   679:     }
   680:     JSObject r = null;
   681:     try {
   682:       r = (JSObject) o.getMember (m);
   683:     } catch (Exception e) {  //NullPointerException | JSException | ClassCastException
   684:       if (APP_DEBUG_TRACE) {
   685:         e.printStackTrace ();
   686:       }
   687:     }
   688:     if (APP_DEBUG_TRACE) {
   689:       System.out.println ("=" + r);
   690:     }
   691:     return r;
   692:   }  //appGetJSObject(JSObject,String)
   693: 
   694:   //r = appIsDefined (o, m)
   695:   //  r=typeof(o.m)!="undefined"
   696:   //  結果をbooleanで返す
   697:   //  try~catch~を書く手間を省く
   698:   public static boolean appIsDefined (JSObject o, String m) {
   699:     if (APP_DEBUG_TRACE) {
   700:       System.out.println ("appIsDefined(" + o + "," + m + ")");
   701:     }
   702:     try {
   703:       o.getMember (m);
   704:       if (APP_DEBUG_TRACE) {
   705:         System.out.println ("=true");
   706:       }
   707:       return true;
   708:     } catch (Exception e) {  //NullPointerException | JSException
   709:       if (APP_DEBUG_TRACE) {
   710:         System.out.println ("=false");
   711:       }
   712:       return false;
   713:     }
   714:   }  //appIsDefined(JSObject,String)
   715: 
   716:   //appCall (o, m, p1, p2, ...)
   717:   //  o.m(p1,p2,...)
   718:   //  結果は捨てる
   719:   //  try~catch~とnew Object[] { p1, p2, ... }を書く手間を省く
   720:   public static void appCall (JSObject o, String m, Object... pa) {
   721:     if (APP_DEBUG_TRACE) {
   722:       System.out.println ("appCall(" + o + "," + m + ",...)");
   723:     }
   724:     try {
   725:       Object r = o.call (m, pa);
   726:       if (APP_DEBUG_TRACE) {
   727:         System.out.println ("=" + r);
   728:       }
   729:     } catch (Exception e) {  //NullPointerException | JSException
   730:       if (APP_DEBUG_TRACE) {
   731:         e.printStackTrace ();
   732:       }
   733:     }
   734:   }  //appCall(JSObject,String,Object...)
   735: 
   736:   //r = appCallBoolean (o, m, p1, p2, ...)
   737:   //  r=o.m(p1,p2,...)
   738:   //  結果をbooleanで返す
   739:   //  失敗したときはfalseを返す
   740:   //  try~catch~とnew Object[] { p1, p2, ... }と(boolean)を書く手間を省く
   741:   public static boolean appCallBoolean (JSObject o, String m, Object... pa) {
   742:     if (APP_DEBUG_TRACE) {
   743:       System.out.println ("appCallBoolean(" + o + "," + m + ",...)");
   744:     }
   745:     boolean r = false;
   746:     try {
   747:       r = (boolean) o.call (m, pa);
   748:     } catch (Exception e) {  //NullPointerException | JSException | ClassCastException
   749:       if (APP_DEBUG_TRACE) {
   750:         e.printStackTrace ();
   751:       }
   752:     }
   753:     if (APP_DEBUG_TRACE) {
   754:       System.out.println ("=" + r);
   755:     }
   756:     return r;
   757:   }  //appCallBoolean(JSObject,String,Object...)
   758: 
   759:   //r = appCallJSObject (o, m, p1, p2, ...)
   760:   //  r=o.m(p1,p2,...)
   761:   //  結果をJSObjectで返す
   762:   //  失敗したときはnullを返す
   763:   //  try~catch~とnew Object[] { p1, p2, ... }と(JSObject)を書く手間を省く
   764:   public static JSObject appCallJSObject (JSObject o, String m, Object... pa) {
   765:     if (APP_DEBUG_TRACE) {
   766:       System.out.println ("appCallJSObject(" + o + "," + m + ",...)");
   767:     }
   768:     JSObject r = null;
   769:     try {
   770:       r = (JSObject) o.call (m, pa);
   771:     } catch (Exception e) {  //NullPointerException | JSException | ClassCastException
   772:       if (APP_DEBUG_TRACE) {
   773:         e.printStackTrace ();
   774:       }
   775:     }
   776:     if (APP_DEBUG_TRACE) {
   777:       System.out.println ("=" + r);
   778:     }
   779:     return r;
   780:   }  //appCallJSObject(JSObject,String,Object)
   781: 
   782:   //r = appCallString (o, m, p1, p2, ...)
   783:   //  r=o.m(p1,p2,...)
   784:   //  結果をStringで返す
   785:   //  失敗したときはnullを返す
   786:   //  try~catch~とnew Object[] { p1, p2, ... }と(String)を書く手間を省く
   787:   public static String appCallString (JSObject o, String m, Object... pa) {
   788:     if (APP_DEBUG_TRACE) {
   789:       System.out.println ("appCallString(" + o + "," + m + ",...)");
   790:     }
   791:     String r = null;
   792:     try {
   793:       r = (String) o.call (m, pa);
   794:     } catch (Exception e) {  //NullPointerException | JSException | ClassCastException
   795:       if (APP_DEBUG_TRACE) {
   796:         e.printStackTrace ();
   797:       }
   798:     }
   799:     if (APP_DEBUG_TRACE) {
   800:       System.out.println ("=" + r);
   801:     }
   802:     return r;
   803:   }  //appCallJSObject(JSObject,String,Object)
   804: 
   805:   //r = appEvalJSObject (s)
   806:   //  r=eval(s)
   807:   //  結果をJSObjectで返す
   808:   //  失敗したときはnullを返す
   809:   //  try~catch~とappWindowと(JSObject)を書く手間を省く
   810:   public static JSObject appEvalJSObject (String s) {
   811:     if (APP_DEBUG_TRACE) {
   812:       System.out.println ("appEvalJSObject(" + s + ")");
   813:     }
   814:     JSObject r = null;
   815:     try {
   816:       r = (JSObject) appWindow.eval (s);
   817:     } catch (Exception e) {  //NullPointerException | JSException | ClassCastException
   818:       if (APP_DEBUG_TRACE) {
   819:         e.printStackTrace ();
   820:       }
   821:     }
   822:     if (APP_DEBUG_TRACE) {
   823:       System.out.println ("=" + r);
   824:     }
   825:     return r;
   826:   }  //appEvalJSObject(String)
   827: 
   828:   //o = appCreate (s)
   829:   //  要素を作る
   830:   public static JSObject appCreate (String s) {
   831:     if (APP_DEBUG_TRACE) {
   832:       System.out.println ("appCreate(" + s + ")");
   833:     }
   834:     JSObject r = appCallJSObject (appDocument, "createElement", s);
   835:     if (APP_DEBUG_TRACE) {
   836:       System.out.println ("=" + r);
   837:     }
   838:     return r;
   839:   }  //appCreate(String)
   840: 
   841:   //o = appText (s)
   842:   //  テキストノードを作る
   843:   public static JSObject appText (String s) {
   844:     if (APP_DEBUG_TRACE) {
   845:       System.out.println ("appText(" + s + ")");
   846:     }
   847:     JSObject r = appCallJSObject (appDocument, "createTextNode", s);
   848:     if (APP_DEBUG_TRACE) {
   849:       System.out.println ("=" + r);
   850:     }
   851:     return r;
   852:   }  //appText(String)
   853: 
   854:   //o = appAppend (o, p1, p2, ...)
   855:   //  要素oに要素p1,p2,...を追加する
   856:   public static JSObject appAppend (JSObject o, JSObject... pa) {
   857:     if (APP_DEBUG_TRACE) {
   858:       System.out.println ("appAppend(" + o.toString () + ",...)");
   859:     }
   860:     for (JSObject p : pa) {
   861:       if (p != null) {
   862:         appCall (o, "appendChild", p);
   863:       }
   864:     }
   865:     if (APP_DEBUG_TRACE) {
   866:       System.out.println ("=" + o);
   867:     }
   868:     return o;
   869:   }  //appAppend(JSObject,JSObject...)
   870: 
   871:   //o = appAttr (o, k1, v1, k2, v2, ...)
   872:   //  o.k1=v1,o.k2=v2,...
   873:   //  要素の属性を設定する
   874:   public static JSObject appAttr (JSObject o, Object... pa) {
   875:     if (APP_DEBUG_TRACE) {
   876:       System.out.println ("appAttr(" + o.toString () + ",...)");
   877:     }
   878:     if (o != null) {
   879:       for (int i = 0; i + 1 < pa.length; i += 2) {
   880:         try {
   881:           String k = (String) pa[i];
   882:           if (k != null) {
   883:             o.setMember (k, pa[i + 1]);
   884:           }
   885:         } catch (Exception e) {
   886:           if (APP_DEBUG_TRACE) {
   887:             e.printStackTrace ();
   888:           }
   889:         }
   890:       }
   891:     }
   892:     if (APP_DEBUG_TRACE) {
   893:       System.out.println ("=" + o);
   894:     }
   895:     return o;
   896:   }  //appAttr(JSObject,Object...)
   897: 
   898:   //o = appStyle (o, k1, v1, k2, v2, ...)
   899:   //  o.style.k1=v1,o.style.k2=v2,...
   900:   //  要素のスタイルを設定する
   901:   public static JSObject appStyle (JSObject o, Object... pa) {
   902:     if (APP_DEBUG_TRACE) {
   903:       System.out.println ("appStyle(" + o.toString () + ",...)");
   904:     }
   905:     appAttr (appGetJSObject (o, "style"), pa);  //返却値はoではなくてo.styleなのでこれを返してはならない
   906:     if (APP_DEBUG_TRACE) {
   907:       System.out.println ("=" + o);
   908:     }
   909:     return o;
   910:   }  //appStyle(JSObject,Object...)
   911: 
   912:   //o = appEvent (o, s, p)
   913:   //  要素にイベントリスナーを追加する
   914:   public static JSObject appEvent (JSObject o, String s, String t) {
   915:     if (APP_DEBUG_TRACE) {
   916:       System.out.println ("appEvent(" + o.toString () + "," + s + "," + t + ")");
   917:     }
   918:     JSObject p = appEvalJSObject ("(function (event) { " + t + " })");  //function(){}は括弧で括らないとエラーになる
   919:     if (appIsDefined (o, "addEventListener")) {
   920:       appCall (o, "addEventListener", s, p, false);  //IE11はon~にsetMemberしても動かない
   921:     } else {
   922:       o.setMember ("on" + s, p);
   923:     }
   924:     if (APP_DEBUG_TRACE) {
   925:       System.out.println ("=" + o);
   926:     }
   927:     return o;
   928:   }  //appEvent(JSObject,String,String)
   929: 
   930: 
   931: 
   932:   //init ()
   933:   //  アプレットの初期化
   934:   @Override public void init () {
   935:     if (APP_DEBUG_TRACE) {
   936:       System.out.println ("init()");
   937:     }
   938:     XEiJ.prgIsApplet = true;  //アプレット
   939:     appApplet = this;
   940:     XEiJ.prgIsJnlp = false;  //JNLPでない
   941:     XEiJ.prgIsLocal = false;  //ローカルでない
   942:     XEiJ.prgArgs = null;
   943:     //起動する
   944:     SwingUtilities.invokeLater (new Runnable () {
   945:       @Override public void run () {
   946:         new XEiJ ();
   947:       }
   948:     });
   949:   }  //init()
   950: 
   951:   //stop ()
   952:   //  アプレットの停止
   953:   @Override public void stop () {
   954:     if (APP_DEBUG_TRACE) {
   955:       System.out.println ("stop()");
   956:     }
   957:     XEiJ.prgTini ();
   958:   }  //stop()
   959: 
   960:   //appWindowOnresize ()
   961:   //  windowオブジェクトのresizeイベント
   962:   public void appWindowOnresize () {
   963:     if (APP_DEBUG_TRACE) {
   964:       System.out.println ("appWindowOnresize()");
   965:     }
   966:     if (appFitInWindowOn) {  //ウインドウに合わせるとき。全画面表示を含む
   967:       appSetSize (Math.max (appMinWidth, appGetWindowInnerWidth (768)),
   968:                   Math.max (appMinHeight, appGetWindowInnerHeight (639)));
   969:     }
   970:     if (appFullscreenOn &&
   971:         appFullscreenElementField != null &&
   972:         appGetJSObject (appDocument, appFullscreenElementField) == null) {  //全画面表示だったはずだが全画面表示になっていない
   973:       appSetFullscreenOn (false);
   974:     }
   975:   }
   976: 
   977:   //appRequestOnclick (on)
   978:   //  全画面表示のYes/Noボタンのclickイベント
   979:   public void appRequestOnclick (boolean on) {
   980:     if (APP_DEBUG_TRACE) {
   981:       System.out.println ("appRequestOnclick()");
   982:     }
   983:     appStyle (appRequestDialog,
   984:               "display", "none");  //ダイアログを消す
   985:     XEiJ.pnlPanel.requestFocusInWindow ();  //パネルにフォーカスを戻す
   986:     XEiJ.mnbFullscreenMenuItem.setEnabled (true);  //全画面表示メニューを有効にする
   987:     if (on) {
   988:       appSetFullscreenOn (true);  //全画面表示に移行する
   989:     }
   990:   }
   991: 
   992:   //appExitOnclick (on)
   993:   //  全画面解除のOkボタンのclickイベント
   994:   public void appExitOnclick (boolean on) {
   995:     if (APP_DEBUG_TRACE) {
   996:       System.out.println ("appExitOnclick()");
   997:     }
   998:     appStyle (appExitDialog,
   999:               "display", "none");  //ダイアログを消す
  1000:     XEiJ.pnlPanel.requestFocusInWindow ();  //パネルにフォーカスを戻す
  1001:     XEiJ.mnbFullscreenMenuItem.setEnabled (true);  //全画面表示メニューを有効にする
  1002:     if (on) {
  1003:       appSetFullscreenOn (false);  //全画面表示を解除する
  1004:     }
  1005:   }
  1006: 
  1007: }  //class XEiJApplet
  1008: 
  1009: 
  1010: