home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / earthlink / nscomm / java40.jar / netscape / application / Application.class (.txt) next >
Encoding:
Java Class File  |  1997-11-03  |  15.2 KB  |  756 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.1";
  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.1";
  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 keyUp(KeyEvent var1) {
  369.    }
  370.  
  371.    protected void beginModalSessionForView(View var1) {
  372.       if (var1 == null) {
  373.          throw new InconsistencyException("beginModalSessionForView called with null view");
  374.       } else {
  375.          this._modalVector.addElement(var1);
  376.          RootView var2 = var1.rootView();
  377.          if (var2 != null) {
  378.             var2.updateCursor();
  379.          }
  380.  
  381.       }
  382.    }
  383.  
  384.    protected void endModalSessionForView(View var1) {
  385.       if (var1 != this._modalVector.lastElement()) {
  386.          throw new InconsistencyException("endModalSessionForView called for a view that is not the last modal view");
  387.       } else {
  388.          this._modalVector.removeLastElement();
  389.          RootView var2 = var1.rootView();
  390.          if (var2 != null) {
  391.             var2.updateCursor();
  392.             var2.validateSelectedView();
  393.          }
  394.  
  395.       }
  396.    }
  397.  
  398.    public View modalView() {
  399.       return this._modalVector.count() > 0 ? (View)this._modalVector.lastElement() : null;
  400.    }
  401.  
  402.    boolean isModalViewShowing() {
  403.       return this._modalVector.count() != 0;
  404.    }
  405.  
  406.    public void performCommandAndWait(Target var1, String var2, Object var3) {
  407.       CommandEvent var4 = new CommandEvent(var1, var2, var3);
  408.       this.eventLoop.addEventAndWait(var4);
  409.    }
  410.  
  411.    public void performCommandLater(Target var1, String var2, Object var3, boolean var4) {
  412.       CommandEvent var5 = new CommandEvent(var1, var2, var3);
  413.       if (var4) {
  414.          this.eventLoop.filterEvents(new CommandFilter(var5.target, var5.command, var3));
  415.       }
  416.  
  417.       this.eventLoop.addEvent(var5);
  418.    }
  419.  
  420.    public void performCommandLater(Target var1, String var2, Object var3) {
  421.       this.performCommandLater(var1, var2, var3, false);
  422.    }
  423.  
  424.    protected FoundationApplet createApplet() {
  425.       Frame var1 = new Frame();
  426.       FoundationApplet var2 = new FoundationApplet();
  427.       ((Container)var1).add(var2);
  428.       var1.addNotify();
  429.       ((Panel)var2).addNotify();
  430.       ((Applet)var2).setStub(new FoundationAppletStub());
  431.       return var2;
  432.    }
  433.  
  434.    String exceptionHeader() {
  435.       return "Uncaught exception.  IFC release: IFC 1.1.1";
  436.    }
  437.  
  438.    public void addObserver(ApplicationObserver var1) {
  439.       this.observers.addElementIfAbsent(var1);
  440.    }
  441.  
  442.    public void removeObserver(ApplicationObserver var1) {
  443.       this.observers.removeElement(var1);
  444.    }
  445.  
  446.    public void appletStarted() {
  447.       int var1 = this.observers.count();
  448.       this.isPaused = false;
  449.  
  450.       while(var1-- > 0) {
  451.          ApplicationObserver var2 = (ApplicationObserver)this.observers.elementAt(var1);
  452.          var2.applicationDidResume(this);
  453.       }
  454.  
  455.       var1 = this.rootViews.count();
  456.  
  457.       while(var1-- > 0) {
  458.          RootView var4 = (RootView)this.rootViews.elementAt(var1);
  459.          if (var4.externalWindow() == null) {
  460.             var4.setVisible(true);
  461.          }
  462.       }
  463.  
  464.    }
  465.  
  466.    public void appletStopped() {
  467.       int var1 = this.observers.count();
  468.       this.isPaused = true;
  469.  
  470.       while(var1-- > 0) {
  471.          ApplicationObserver var2 = (ApplicationObserver)this.observers.elementAt(var1);
  472.          var2.applicationDidPause(this);
  473.       }
  474.  
  475.       var1 = this.rootViews.count();
  476.  
  477.       while(var1-- > 0) {
  478.          RootView var4 = (RootView)this.rootViews.elementAt(var1);
  479.          if (var4.externalWindow() == null) {
  480.             var4.setVisible(false);
  481.          }
  482.       }
  483.  
  484.    }
  485.  
  486.    void applicationDidStart() {
  487.       int var1 = this.observers.count();
  488.  
  489.       while(var1-- > 0) {
  490.          ApplicationObserver var2 = (ApplicationObserver)this.observers.elementAt(var1);
  491.          var2.applicationDidStart(this);
  492.       }
  493.  
  494.    }
  495.  
  496.    void applicationDidStop() {
  497.       int var1 = this.observers.count();
  498.  
  499.       while(var1-- > 0) {
  500.          ApplicationObserver var2 = (ApplicationObserver)this.observers.elementAt(var1);
  501.          var2.applicationDidStop(this);
  502.       }
  503.  
  504.    }
  505.  
  506.    public void processEvent(Event var1) {
  507.       if (var1 instanceof ApplicationEvent) {
  508.          if (var1.type == -26) {
  509.             this.appletStopped();
  510.             return;
  511.          }
  512.  
  513.          if (var1.type == -27) {
  514.             this.appletStarted();
  515.          }
  516.       }
  517.  
  518.    }
  519.  
  520.    public boolean isRunning() {
  521.       return this.eventLoop.isRunning();
  522.    }
  523.  
  524.    public boolean isPaused() {
  525.       return this.isPaused;
  526.    }
  527.  
  528.    static Clipboard clipboard() {
  529.       Object var1 = clipboardLock;
  530.       synchronized(var1){}
  531.  
  532.       Clipboard var0;
  533.       try {
  534.          if (clipboard == null) {
  535.             clipboard = JDK11AirLock.clipboard();
  536.             if (clipboard == null) {
  537.                clipboard = new TextBag();
  538.             }
  539.          }
  540.  
  541.          var0 = clipboard;
  542.       } catch (Throwable var4) {
  543.          throw var4;
  544.       }
  545.  
  546.       return var0;
  547.    }
  548.  
  549.    public void makeCurrentDocumentWindow(Window var1) {
  550.       if (var1 != null && !var1.containsDocument()) {
  551.          throw new InconsistencyException("makeCurrentDocumentWindow: window is not a document");
  552.       } else {
  553.          if (this.currentDocumentWindow != null) {
  554.             this.currentDocumentWindow.didResignCurrentDocument();
  555.             this.currentDocumentWindow = null;
  556.          }
  557.  
  558.          if (var1 != null) {
  559.             this.currentDocumentWindow = var1;
  560.             this.currentDocumentWindow.didBecomeCurrentDocument();
  561.          }
  562.  
  563.          int var2 = this.observers.count();
  564.  
  565.          while(var2-- > 0) {
  566.             ApplicationObserver var3 = (ApplicationObserver)this.observers.elementAt(var2);
  567.  
  568.             try {
  569.                var3.currentDocumentDidChange(this, this.currentDocumentWindow);
  570.             } catch (IncompatibleClassChangeError var4) {
  571.             }
  572.          }
  573.  
  574.       }
  575.    }
  576.  
  577.    public Window currentDocumentWindow() {
  578.       return this.currentDocumentWindow;
  579.    }
  580.  
  581.    public void chooseNextCurrentDocumentWindow(Window var1) {
  582.       Window var2 = null;
  583.       if (var1 != null && !(var1 instanceof ExternalWindow)) {
  584.          if (((InternalWindow)var1).rootView() != null) {
  585.             var2 = this._chooseNextInternalWindowWithDocument(((InternalWindow)var1).rootView(), (InternalWindow)var1);
  586.          }
  587.       } else {
  588.          var2 = this._chooseNextExternalWindowWithDocument((ExternalWindow)var1);
  589.          if (var2 == null && this.mainRootView() != null) {
  590.             var2 = this._chooseNextInternalWindowWithDocument(this.mainRootView(), (InternalWindow)null);
  591.          }
  592.       }
  593.  
  594.       this.makeCurrentDocumentWindow(var2);
  595.    }
  596.  
  597.    Window _chooseNextInternalWindowWithDocument(RootView var1, InternalWindow var2) {
  598.       Vector var3 = var1.internalWindows();
  599.  
  600.       for(int var5 = var3.count() - 1; var5 >= 0; --var5) {
  601.          InternalWindow var4 = (InternalWindow)var3.elementAt(var5);
  602.          if (var4 != var2 && var4.containsDocument()) {
  603.             return var4;
  604.          }
  605.       }
  606.  
  607.       return null;
  608.    }
  609.  
  610.    Window _chooseNextExternalWindowWithDocument(ExternalWindow var1) {
  611.       Vector var2 = this.externalWindows();
  612.  
  613.       for(int var4 = var2.count() - 1; var4 >= 0; --var4) {
  614.          ExternalWindow var3 = (ExternalWindow)var2.elementAt(var4);
  615.          if (var3 != var1 && var3.containsDocument()) {
  616.             return var3;
  617.          }
  618.       }
  619.  
  620.       return null;
  621.    }
  622.  
  623.    void focusChanged(View var1) {
  624.       int var2 = this.observers.count();
  625.  
  626.       while(var2-- > 0) {
  627.          ApplicationObserver var3 = (ApplicationObserver)this.observers.elementAt(var2);
  628.  
  629.          try {
  630.             var3.focusDidChange(this, var1);
  631.          } catch (IncompatibleClassChangeError var4) {
  632.          }
  633.       }
  634.  
  635.    }
  636.  
  637.    KeyboardArrow keyboardArrow() {
  638.       if (this.keyboardArrow == null) {
  639.          this.keyboardArrow = new KeyboardArrow();
  640.       }
  641.  
  642.       return this.keyboardArrow;
  643.    }
  644.  
  645.    public int keyboardArrowPosition(View var1) {
  646.       RootView var2 = var1.rootView();
  647.       Rect var3 = ((View)var2).localBounds();
  648.       new Point();
  649.       Rect var4 = new Rect();
  650.       var1.computeVisibleRect(var4);
  651.       var4.intersectWith(var1.keyboardRect());
  652.       var1.convertRectToView(var2, var4, var4);
  653.  
  654.       for(int var8 = 0; var8 <= 3; ++var8) {
  655.          Image var5 = this.keyboardArrowImage(var8);
  656.          Point var6 = this.keyboardArrowHotSpot(var8);
  657.          Point var7 = this.keyboardArrowLocation(var1, var8);
  658.          var7.x -= var6.x;
  659.          var7.y -= var6.y;
  660.          if (var3.contains(new Rect(var7.x, var7.y, var5.width(), var5.height()))) {
  661.             return var8;
  662.          }
  663.       }
  664.  
  665.       return 0;
  666.    }
  667.  
  668.    public Image keyboardArrowImage(int var1) {
  669.       switch (var1) {
  670.          case 0:
  671.             return Bitmap.bitmapNamed("netscape/application/topLeftArrow.gif");
  672.          case 1:
  673.             return Bitmap.bitmapNamed("netscape/application/bottomLeftArrow.gif");
  674.          case 2:
  675.             return Bitmap.bitmapNamed("netscape/application/topRightArrow.gif");
  676.          case 3:
  677.             return Bitmap.bitmapNamed("netscape/application/bottomRightArrow.gif");
  678.          default:
  679.             return null;
  680.       }
  681.    }
  682.  
  683.    public Point keyboardArrowHotSpot(int var1) {
  684.       switch (var1) {
  685.          case 0:
  686.             return new Point(8, 12);
  687.          case 1:
  688.             return new Point(8, 0);
  689.          case 2:
  690.             return new Point(0, 12);
  691.          case 3:
  692.             return new Point(0, 0);
  693.          default:
  694.             return null;
  695.       }
  696.    }
  697.  
  698.    public Point keyboardArrowLocation(View var1, int var2) {
  699.       RootView var3 = var1.rootView();
  700.       ((View)var3).localBounds();
  701.       Rect var4 = var1.localBounds();
  702.       var4 = new Rect();
  703.       var1.computeVisibleRect(var4);
  704.       var4.intersectWith(var1.keyboardRect());
  705.       if (var4.width != 0 && var4.height != 0) {
  706.          var1.convertRectToView(var1.rootView(), var4, var4);
  707.          switch (var2) {
  708.             case 0:
  709.                return new Point(var4.x, var4.y);
  710.             case 1:
  711.                return new Point(var4.x, var4.y + var4.height);
  712.             case 2:
  713.                return new Point(var4.x + var4.width, var4.y);
  714.             case 3:
  715.                return new Point(var4.x + var4.width, var4.y + var4.height);
  716.             default:
  717.                throw new InconsistencyException("Unknown position " + var2);
  718.          }
  719.       } else {
  720.          return new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
  721.       }
  722.    }
  723.  
  724.    public void setKeyboardUIEnabled(boolean var1) {
  725.       this._kbdUIEnabled = var1;
  726.    }
  727.  
  728.    public boolean isKeyboardUIEnabled() {
  729.       return this._kbdUIEnabled;
  730.    }
  731.  
  732.    public Applet applet() {
  733.       return this.applet;
  734.    }
  735.  
  736.    public AppletResources appletResources() {
  737.       return this._appResources;
  738.    }
  739.  
  740.    public static String clipboardText() {
  741.       return clipboard().text();
  742.    }
  743.  
  744.    public static void setClipboardText(String var0) {
  745.       clipboard().setText(var0);
  746.    }
  747.  
  748.    public void setHandleJDK11MouseEvents(boolean var1) {
  749.       this.jdkMouseEventHackEnabled = var1;
  750.    }
  751.  
  752.    public boolean handleJDK11MouseEvents() {
  753.       return this.jdkMouseEventHackEnabled;
  754.    }
  755. }
  756.