home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIPHEFT062001.ISO / browser / nc32lyc / comm.z / java40.jar / netscape / application / Application.class (.txt) next >
Encoding:
Java Class File  |  2000-08-15  |  17.9 KB  |  768 lines

  1. package netscape.application;
  2.  
  3. import java.applet.Applet;
  4. import java.applet.AppletContext;
  5. import java.awt.Component;
  6. import java.awt.Container;
  7. import java.awt.Frame;
  8. import java.awt.MediaTracker;
  9. import java.awt.Panel;
  10. import java.io.InputStream;
  11. import java.net.URL;
  12. import netscape.util.Enumeration;
  13. import netscape.util.Hashtable;
  14. import netscape.util.InconsistencyException;
  15. import netscape.util.Vector;
  16.  
  17. public class Application implements Runnable, EventProcessor {
  18.    static Hashtable groupToApplication = new Hashtable();
  19.    static final String _releaseName = "IFC 1.1.2";
  20.    static Clipboard clipboard;
  21.    static Object clipboardLock = new Object();
  22.    Applet applet;
  23.    AppletResources _appResources;
  24.    EventLoop eventLoop = new EventLoop();
  25.    Vector _languageVector;
  26.    Vector rootViews = new Vector();
  27.    RootView mainRootView;
  28.    boolean didCreateApplet;
  29.    Vector _modalVector = new Vector();
  30.    Vector observers = new Vector();
  31.    Vector activeMenuViews = new Vector();
  32.    boolean jdkMouseEventHackEnabled = true;
  33.    MediaTracker tracker;
  34.    int bitmapCount;
  35.    Hashtable bitmapByName = new Hashtable();
  36.    Hashtable soundByName = new Hashtable();
  37.    Hashtable fontByName = new Hashtable();
  38.    DebugGraphicsInfo debugGraphicsInfo;
  39.    TimerQueue timerQueue;
  40.    Object cleanupLock;
  41.    boolean isPaused;
  42.    boolean _kbdUIEnabled = true;
  43.    Window currentDocumentWindow;
  44.    KeyboardArrow keyboardArrow;
  45.    public static final int TOP_LEFT_POSITION = 0;
  46.    public static final int BOTTOM_LEFT_POSITION = 1;
  47.    public static final int TOP_RIGHT_POSITION = 2;
  48.    public static final int BOTTOM_RIGHT_POSITION = 3;
  49.    static final int FIRST_POSITION = 0;
  50.    static final int LAST_POSITION = 3;
  51.    static final int arrowXOffset = 0;
  52.    static final int arrowYOffset = 0;
  53.  
  54.    public Application() {
  55.       groupToApplication.put(Thread.currentThread().getThreadGroup(), this);
  56.       FoundationApplet var1 = FoundationApplet.applet();
  57.       if (var1 == null) {
  58.          var1 = this.createApplet();
  59.          var1.setApplication(this);
  60.          this.didCreateApplet = true;
  61.       } else {
  62.          this.isPaused = true;
  63.          var1.setupCanvas(this);
  64.       }
  65.  
  66.       this.applet = var1;
  67.       this._appResources = new AppletResources(this, this.codeBase());
  68.       this.timerQueue = new TimerQueue();
  69.       this.eventLoop.application = this;
  70.    }
  71.  
  72.    public static String releaseName() {
  73.       return "IFC 1.1.2";
  74.    }
  75.  
  76.    public Application(Applet var1) {
  77.       groupToApplication.put(Thread.currentThread().getThreadGroup(), this);
  78.       this.applet = var1;
  79.       this._appResources = new AppletResources(this, this.codeBase());
  80.       this.timerQueue = new TimerQueue();
  81.       this.appletStarted();
  82.       this.eventLoop.application = this;
  83.    }
  84.  
  85.    public static Application application() {
  86.       ThreadGroup var0 = Thread.currentThread().getThreadGroup();
  87.       Application var1 = (Application)groupToApplication.get(var0);
  88.       if (var1 == null) {
  89.          var1 = FoundationApplet.currentApplication();
  90.       }
  91.  
  92.       return var1;
  93.    }
  94.  
  95.    public void init() {
  96.    }
  97.  
  98.    public void cleanup() {
  99.       Enumeration var1 = groupToApplication.keys();
  100.       this.applicationDidStop();
  101.       if (this.applet instanceof FoundationApplet) {
  102.          ((FoundationApplet)this.applet).cleanup();
  103.       }
  104.  
  105.       if (this.didCreateApplet) {
  106.          ((FoundationApplet)this.applet).destroyFromIFC();
  107.          if (this.applet.getParent() != null) {
  108.             this.applet.getParent().remove(this.applet);
  109.          }
  110.       }
  111.  
  112.       while(var1.hasMoreElements()) {
  113.          ThreadGroup var2 = (ThreadGroup)var1.nextElement();
  114.          Application var3 = (Application)groupToApplication.get(var2);
  115.          if (var3 == this) {
  116.             groupToApplication.remove(var2);
  117.             break;
  118.          }
  119.       }
  120.  
  121.       this.timerQueue = null;
  122.       this.observers.removeAllElements();
  123.       this.eventLoop.application = null;
  124.    }
  125.  
  126.    public void stopRunning() {
  127.       this.eventLoop.stopRunning();
  128.    }
  129.  
  130.    void stopRunningForAWT() {
  131.       Object var1 = this.cleanupLock;
  132.       synchronized(var1){}
  133.  
  134.       try {
  135.          this.eventLoop.stopRunning();
  136.  
  137.          while(true) {
  138.             try {
  139.                this.cleanupLock.wait();
  140.                return;
  141.             } catch (InterruptedException var5) {
  142.             }
  143.          }
  144.       } catch (Throwable var6) {
  145.          throw var6;
  146.       }
  147.    }
  148.  
  149.    public void run() {
  150.       this.cleanupLock = new Object();
  151.       this.applicationDidStart();
  152.       this.init();
  153.       this.eventLoop.run();
  154.       this.cleanup();
  155.       Object var1 = this.cleanupLock;
  156.       synchronized(var1){}
  157.  
  158.       try {
  159.          this.cleanupLock.notify();
  160.       } catch (Throwable var3) {
  161.          throw var3;
  162.       }
  163.  
  164.    }
  165.  
  166.    public EventLoop eventLoop() {
  167.       return this.eventLoop;
  168.    }
  169.  
  170.    Vector languagePreferences() {
  171.       if (this._languageVector == null) {
  172.          this._languageVector = new Vector();
  173.       }
  174.  
  175.       return this._languageVector;
  176.    }
  177.  
  178.    void syncGraphics() {
  179.    }
  180.  
  181.    InputStream streamForInterface(String var1) {
  182.       return this._appResources.streamForInterface(var1);
  183.    }
  184.  
  185.    InputStream streamForResourceOfType(String var1, String var2) {
  186.       return this._appResources.streamForResourceOfType(var1, var2);
  187.    }
  188.  
  189.    public boolean isApplet() {
  190.       return !this.didCreateApplet;
  191.    }
  192.  
  193.    InputStream streamForRelativePath(String var1) {
  194.       URL var2;
  195.       try {
  196.          var2 = new URL(this.codeBase(), var1);
  197.       } catch (Exception var6) {
  198.          System.err.println("Application.streamForRelativePath() - " + var6);
  199.          var2 = null;
  200.       }
  201.  
  202.       if (var2 == null) {
  203.          return null;
  204.       } else {
  205.          InputStream var3;
  206.          try {
  207.             var3 = var2.openStream();
  208.          } catch (Exception var5) {
  209.             System.err.println("Application.streamForURL() - Trouble retrieving URL " + var2 + " : " + var5);
  210.             var3 = null;
  211.          }
  212.  
  213.          return var3;
  214.       }
  215.    }
  216.  
  217.    AppletContext getAppletContext() {
  218.       return this.applet == null ? null : this.applet.getAppletContext();
  219.    }
  220.  
  221.    public URL codeBase() {
  222.       return this.applet.getCodeBase();
  223.    }
  224.  
  225.    public String parameterNamed(String var1) {
  226.       return this.applet == null ? null : this.applet.getParameter(var1);
  227.    }
  228.  
  229.    public RootView mainRootView() {
  230.       return this.mainRootView;
  231.    }
  232.  
  233.    public void setMainRootView(RootView var1) {
  234.       this.addRootView(var1);
  235.       this.mainRootView = var1;
  236.    }
  237.  
  238.    RootView firstRootView() {
  239.       return (RootView)this.rootViews.lastElement();
  240.    }
  241.  
  242.    public Vector rootViews() {
  243.       return this.rootViews;
  244.    }
  245.  
  246.    public Vector externalWindows() {
  247.       int var2 = this.rootViews.count();
  248.       Vector var3 = new Vector();
  249.  
  250.       for(int var1 = 0; var1 < var2; ++var1) {
  251.          RootView var4 = (RootView)this.rootViews.elementAt(var1);
  252.          ExternalWindow var5 = var4.externalWindow();
  253.          if (var5 != null) {
  254.             var3.addElement(var5);
  255.          }
  256.       }
  257.  
  258.       return var3;
  259.    }
  260.  
  261.    void addRootView(RootView var1) {
  262.       if (!this.rootViews.contains(var1)) {
  263.          this.rootViews.insertElementAt(var1, 0);
  264.          var1.setApplication(this);
  265.       }
  266.  
  267.    }
  268.  
  269.    void removeRootView(RootView var1) {
  270.       this.rootViews.removeElement(var1);
  271.       var1.setApplication((Application)null);
  272.       if (this.rootViews.count() > 0) {
  273.          ((RootView)this.rootViews.lastElement()).didBecomeFirstRootView();
  274.       }
  275.  
  276.    }
  277.  
  278.    void makeFirstRootView(RootView var1) {
  279.       if (this.rootViews.indexOf(var1) != -1) {
  280.          if (this.rootViews.lastElement() != var1) {
  281.             RootView var2 = (RootView)this.rootViews.lastElement();
  282.             this.rootViews.removeElement(var1);
  283.             this.rootViews.addElement(var1);
  284.             if (var2 != null) {
  285.                var2.didResignFirstRootView();
  286.             }
  287.  
  288.             var1.didBecomeFirstRootView();
  289.          }
  290.  
  291.       }
  292.    }
  293.  
  294.    Frame frame() {
  295.       Object var1;
  296.       for(var1 = this.applet; var1 != null && !(var1 instanceof Frame); var1 = ((Component)var1).getParent()) {
  297.       }
  298.  
  299.       return var1 != null ? (Frame)var1 : null;
  300.    }
  301.  
  302.    synchronized MediaTracker mediaTracker() {
  303.       if (this.tracker == null) {
  304.          this.tracker = new MediaTracker(this.applet);
  305.       }
  306.  
  307.       return this.tracker;
  308.    }
  309.  
  310.    synchronized int nextBitmapNumber() {
  311.       return this.bitmapCount++;
  312.    }
  313.  
  314.    synchronized TimerQueue timerQueue() {
  315.       return this.timerQueue;
  316.    }
  317.  
  318.    void addActiveMenuView(MenuView var1) {
  319.       this.activeMenuViews.addElementIfAbsent(var1);
  320.    }
  321.  
  322.    void removeActiveMenuView(MenuView var1) {
  323.       this.activeMenuViews.removeElement(var1);
  324.    }
  325.  
  326.    public void willProcessEvent(Event var1) {
  327.    }
  328.  
  329.    void willProcessInternalEvent(Event var1) {
  330.       if (this.activeMenuViews.count() != 0 && var1.type() == -1) {
  331.          MenuView var2 = (MenuView)this.activeMenuViews.lastElement();
  332.          var2.mouseWillDown((MouseEvent)var1);
  333.       }
  334.    }
  335.  
  336.    public void didProcessEvent(Event var1) {
  337.    }
  338.  
  339.    void didProcessInternalEvent(Event var1) {
  340.       this.drawAllDirtyViews();
  341.    }
  342.  
  343.    protected void drawAllDirtyViews() {
  344.       int var2 = this.rootViews.count();
  345.  
  346.       for(int var1 = 0; var1 < var2; ++var1) {
  347.          RootView var3 = (RootView)this.rootViews.elementAt(var1);
  348.          var3.drawDirtyViews();
  349.          var3._updateCursorAndMoveView();
  350.       }
  351.  
  352.    }
  353.  
  354.    boolean isMac() {
  355.       String var1 = System.getProperty("os.name");
  356.       return var1 != null && var1.startsWith("Mac");
  357.    }
  358.  
  359.    public void keyDown(KeyEvent var1) {
  360.       boolean var2 = false;
  361.       RootView var3 = this.firstRootView();
  362.       if (var3 != null) {
  363.          var3.processKeyboardEvent(var1, false);
  364.       }
  365.  
  366.    }
  367.  
  368.    public void keyTyped(KeyEvent var1) {
  369.    }
  370.  
  371.    public void keyUp(KeyEvent var1) {
  372.    }
  373.  
  374.    protected void beginModalSessionForView(View var1) {
  375.       if (var1 == null) {
  376.          throw new InconsistencyException("beginModalSessionForView called with null view");
  377.       } else {
  378.          this._modalVector.addElement(var1);
  379.          RootView var2 = var1.rootView();
  380.          if (var2 != null) {
  381.             var2.updateCursor();
  382.          }
  383.  
  384.       }
  385.    }
  386.  
  387.    protected void endModalSessionForView(View var1) {
  388.       if (var1 != this._modalVector.lastElement()) {
  389.          throw new InconsistencyException("endModalSessionForView called for a view that is not the last modal view");
  390.       } else {
  391.          this._modalVector.removeLastElement();
  392.          RootView var2 = var1.rootView();
  393.          if (var2 != null) {
  394.             var2.updateCursor();
  395.             var2.validateSelectedView();
  396.          }
  397.  
  398.       }
  399.    }
  400.  
  401.    public View modalView() {
  402.       return this._modalVector.count() > 0 ? (View)this._modalVector.lastElement() : null;
  403.    }
  404.  
  405.    boolean isModalViewShowing() {
  406.       return this._modalVector.count() != 0;
  407.    }
  408.  
  409.    public void performCommandAndWait(Target var1, String var2, Object var3) {
  410.       CommandEvent var4 = new CommandEvent(var1, var2, var3);
  411.       this.eventLoop.addEventAndWait(var4);
  412.    }
  413.  
  414.    public void performCommandLater(Target var1, String var2, Object var3, boolean var4) {
  415.       CommandEvent var5 = new CommandEvent(var1, var2, var3);
  416.       if (var4) {
  417.          this.eventLoop.filterEvents(new CommandFilter(var5.target, var5.command, var3));
  418.       }
  419.  
  420.       this.eventLoop.addEvent(var5);
  421.    }
  422.  
  423.    public void performCommandLater(Target var1, String var2, Object var3) {
  424.       this.performCommandLater(var1, var2, var3, false);
  425.    }
  426.  
  427.    protected FoundationApplet createApplet() {
  428.       Frame var1 = new Frame();
  429.       FoundationApplet var2 = new FoundationApplet();
  430.       ((Container)var1).add(var2);
  431.       var1.addNotify();
  432.       ((Panel)var2).addNotify();
  433.       ((Applet)var2).setStub(new FoundationAppletStub());
  434.       return var2;
  435.    }
  436.  
  437.    String exceptionHeader() {
  438.       return "Uncaught exception.  IFC release: IFC 1.1.2";
  439.    }
  440.  
  441.    public void addObserver(ApplicationObserver var1) {
  442.       this.observers.addElementIfAbsent(var1);
  443.    }
  444.  
  445.    public void removeObserver(ApplicationObserver var1) {
  446.       this.observers.removeElement(var1);
  447.    }
  448.  
  449.    public void appletStarted() {
  450.       int var1 = this.observers.count();
  451.       this.isPaused = false;
  452.  
  453.       while(var1-- > 0) {
  454.          ApplicationObserver var2 = (ApplicationObserver)this.observers.elementAt(var1);
  455.          var2.applicationDidResume(this);
  456.       }
  457.  
  458.       var1 = this.rootViews.count();
  459.  
  460.       while(var1-- > 0) {
  461.          RootView var4 = (RootView)this.rootViews.elementAt(var1);
  462.          if (var4.externalWindow() == null) {
  463.             var4.setVisible(true);
  464.          }
  465.       }
  466.  
  467.    }
  468.  
  469.    public void appletStopped() {
  470.       int var1 = this.observers.count();
  471.       this.isPaused = true;
  472.  
  473.       while(var1-- > 0) {
  474.          ApplicationObserver var2 = (ApplicationObserver)this.observers.elementAt(var1);
  475.          var2.applicationDidPause(this);
  476.       }
  477.  
  478.       var1 = this.rootViews.count();
  479.  
  480.       while(var1-- > 0) {
  481.          RootView var4 = (RootView)this.rootViews.elementAt(var1);
  482.          if (var4.externalWindow() == null) {
  483.             var4.setVisible(false);
  484.          }
  485.       }
  486.  
  487.    }
  488.  
  489.    void applicationDidStart() {
  490.       int var1 = this.observers.count();
  491.  
  492.       while(var1-- > 0) {
  493.          ApplicationObserver var2 = (ApplicationObserver)this.observers.elementAt(var1);
  494.          var2.applicationDidStart(this);
  495.       }
  496.  
  497.    }
  498.  
  499.    void applicationDidStop() {
  500.       int var1 = this.observers.count();
  501.  
  502.       while(var1-- > 0) {
  503.          ApplicationObserver var2 = (ApplicationObserver)this.observers.elementAt(var1);
  504.          var2.applicationDidStop(this);
  505.       }
  506.  
  507.    }
  508.  
  509.    public void processEvent(Event var1) {
  510.       if (var1 instanceof ApplicationEvent) {
  511.          if (var1.type == -26) {
  512.             this.appletStopped();
  513.             return;
  514.          }
  515.  
  516.          if (var1.type == -27) {
  517.             this.appletStarted();
  518.          }
  519.       }
  520.  
  521.    }
  522.  
  523.    public boolean isRunning() {
  524.       return this.eventLoop.isRunning();
  525.    }
  526.  
  527.    public boolean isPaused() {
  528.       return this.isPaused;
  529.    }
  530.  
  531.    static Clipboard clipboard() {
  532.       Object var1 = clipboardLock;
  533.       synchronized(var1){}
  534.  
  535.       Clipboard var0;
  536.       try {
  537.          if (clipboard == null) {
  538.             clipboard = JDK11AirLock.clipboard();
  539.             if (clipboard == null) {
  540.                clipboard = new TextBag();
  541.             }
  542.          }
  543.  
  544.          var0 = clipboard;
  545.       } catch (Throwable var4) {
  546.          throw var4;
  547.       }
  548.  
  549.       return var0;
  550.    }
  551.  
  552.    public void makeCurrentDocumentWindow(Window var1) {
  553.       if (var1 != null && !var1.containsDocument()) {
  554.          throw new InconsistencyException("makeCurrentDocumentWindow: window is not a document");
  555.       } else {
  556.          if (this.currentDocumentWindow != null) {
  557.             this.currentDocumentWindow.didResignCurrentDocument();
  558.             this.currentDocumentWindow = null;
  559.          }
  560.  
  561.          if (var1 != null) {
  562.             this.currentDocumentWindow = var1;
  563.             this.currentDocumentWindow.didBecomeCurrentDocument();
  564.          }
  565.  
  566.          int var2 = this.observers.count();
  567.  
  568.          while(var2-- > 0) {
  569.             ApplicationObserver var3 = (ApplicationObserver)this.observers.elementAt(var2);
  570.  
  571.             try {
  572.                var3.currentDocumentDidChange(this, this.currentDocumentWindow);
  573.             } catch (IncompatibleClassChangeError var4) {
  574.             }
  575.          }
  576.  
  577.       }
  578.    }
  579.  
  580.    public Window currentDocumentWindow() {
  581.       return this.currentDocumentWindow;
  582.    }
  583.  
  584.    public void chooseNextCurrentDocumentWindow(Window var1) {
  585.       Window var2 = null;
  586.       if (var1 != null && !(var1 instanceof ExternalWindow)) {
  587.          if (((InternalWindow)var1).rootView() != null) {
  588.             var2 = this._chooseNextInternalWindowWithDocument(((InternalWindow)var1).rootView(), (InternalWindow)var1);
  589.          }
  590.       } else {
  591.          var2 = this._chooseNextExternalWindowWithDocument((ExternalWindow)var1);
  592.          if (var2 == null && this.mainRootView() != null) {
  593.             var2 = this._chooseNextInternalWindowWithDocument(this.mainRootView(), (InternalWindow)null);
  594.          }
  595.       }
  596.  
  597.       this.makeCurrentDocumentWindow(var2);
  598.    }
  599.  
  600.    Window _chooseNextInternalWindowWithDocument(RootView var1, InternalWindow var2) {
  601.       Vector var3 = var1.internalWindows();
  602.  
  603.       for(int var5 = var3.count() - 1; var5 >= 0; --var5) {
  604.          InternalWindow var4 = (InternalWindow)var3.elementAt(var5);
  605.          if (var4 != var2 && var4.containsDocument()) {
  606.             return var4;
  607.          }
  608.       }
  609.  
  610.       return null;
  611.    }
  612.  
  613.    Window _chooseNextExternalWindowWithDocument(ExternalWindow var1) {
  614.       Vector var2 = this.externalWindows();
  615.  
  616.       for(int var4 = var2.count() - 1; var4 >= 0; --var4) {
  617.          ExternalWindow var3 = (ExternalWindow)var2.elementAt(var4);
  618.          if (var3 != var1 && var3.containsDocument()) {
  619.             return var3;
  620.          }
  621.       }
  622.  
  623.       return null;
  624.    }
  625.  
  626.    void focusChanged(View var1) {
  627.       int var2 = this.observers.count();
  628.  
  629.       while(var2-- > 0) {
  630.          ApplicationObserver var3 = (ApplicationObserver)this.observers.elementAt(var2);
  631.  
  632.          try {
  633.             var3.focusDidChange(this, var1);
  634.          } catch (IncompatibleClassChangeError var4) {
  635.          }
  636.       }
  637.  
  638.    }
  639.  
  640.    KeyboardArrow keyboardArrow() {
  641.       if (this.keyboardArrow == null) {
  642.          this.keyboardArrow = new KeyboardArrow();
  643.       }
  644.  
  645.       return this.keyboardArrow;
  646.    }
  647.  
  648.    public int keyboardArrowPosition(View var1) {
  649.       RootView var2 = var1.rootView();
  650.       Rect var3 = ((View)var2).localBounds();
  651.       new Point();
  652.       Rect var4 = new Rect();
  653.       var1.computeVisibleRect(var4);
  654.       var4.intersectWith(var1.keyboardRect());
  655.       var1.convertRectToView(var2, var4, var4);
  656.  
  657.       for(int var8 = 0; var8 <= 3; ++var8) {
  658.          Image var5 = this.keyboardArrowImage(var8);
  659.          Point var6 = this.keyboardArrowHotSpot(var8);
  660.          Point var7 = this.keyboardArrowLocation(var1, var8);
  661.          var7.x -= var6.x;
  662.          var7.y -= var6.y;
  663.          if (var3.contains(new Rect(var7.x, var7.y, var5.width(), var5.height()))) {
  664.             return var8;
  665.          }
  666.       }
  667.  
  668.       return 0;
  669.    }
  670.  
  671.    public Image keyboardArrowImage(int var1) {
  672.       switch (var1) {
  673.          case 0:
  674.             return Bitmap.bitmapNamed("netscape/application/topLeftArrow.gif");
  675.          case 1:
  676.             return Bitmap.bitmapNamed("netscape/application/bottomLeftArrow.gif");
  677.          case 2:
  678.             return Bitmap.bitmapNamed("netscape/application/topRightArrow.gif");
  679.          case 3:
  680.             return Bitmap.bitmapNamed("netscape/application/bottomRightArrow.gif");
  681.          default:
  682.             return null;
  683.       }
  684.    }
  685.  
  686.    public Point keyboardArrowHotSpot(int var1) {
  687.       switch (var1) {
  688.          case 0:
  689.             return new Point(8, 12);
  690.          case 1:
  691.             return new Point(8, 0);
  692.          case 2:
  693.             return new Point(0, 12);
  694.          case 3:
  695.             return new Point(0, 0);
  696.          default:
  697.             return null;
  698.       }
  699.    }
  700.  
  701.    public Point keyboardArrowLocation(View var1, int var2) {
  702.       RootView var3 = var1.rootView();
  703.       ((View)var3).localBounds();
  704.       Rect var4 = var1.localBounds();
  705.       var4 = new Rect();
  706.       var1.computeVisibleRect(var4);
  707.       var4.intersectWith(var1.keyboardRect());
  708.       if (var4.width != 0 && var4.height != 0) {
  709.          var1.convertRectToView(var1.rootView(), var4, var4);
  710.          switch (var2) {
  711.             case 0:
  712.                return new Point(var4.x, var4.y);
  713.             case 1:
  714.                return new Point(var4.x, var4.y + var4.height);
  715.             case 2:
  716.                return new Point(var4.x + var4.width, var4.y);
  717.             case 3:
  718.                return new Point(var4.x + var4.width, var4.y + var4.height);
  719.             default:
  720.                throw new InconsistencyException("Unknown position " + var2);
  721.          }
  722.       } else {
  723.          return new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
  724.       }
  725.    }
  726.  
  727.    public void setKeyboardUIEnabled(boolean var1) {
  728.       this._kbdUIEnabled = var1;
  729.    }
  730.  
  731.    public boolean isKeyboardUIEnabled() {
  732.       return this._kbdUIEnabled;
  733.    }
  734.  
  735.    public Applet applet() {
  736.       return this.applet;
  737.    }
  738.  
  739.    public AppletResources appletResources() {
  740.       return this._appResources;
  741.    }
  742.  
  743.    public static String clipboardText() {
  744.       return clipboard().text();
  745.    }
  746.  
  747.    public static void setClipboardText(String var0) {
  748.       clipboard().setText(var0);
  749.    }
  750.  
  751.    public void setHandleJDK11MouseEvents(boolean var1) {
  752.       this.jdkMouseEventHackEnabled = var1;
  753.    }
  754.  
  755.    public boolean handleJDK11MouseEvents() {
  756.       return this.jdkMouseEventHackEnabled;
  757.    }
  758.  
  759.    public boolean handleExtendedKeyEvent() {
  760.       return false;
  761.    }
  762.  
  763.    public Class classForName(String var1) throws ClassNotFoundException {
  764.       Applet var2 = this.applet();
  765.       return var2 instanceof FoundationApplet ? ((FoundationApplet)var2).classForName(var1) : Class.forName(var1);
  766.    }
  767. }
  768.