Class MainFrame

java.lang.Object
com.sun.javatest.util.MainFrame

public class MainFrame extends Object
This class provides a means whereby tools in Personal Java can temporarily give access to a shared GUI frame, such as the one top-level Frame.
  • Constructor Details

    • MainFrame

      public MainFrame()
  • Method Details

    • setFrame

      public static void setFrame(Frame f)
      Set a frame that can be subsequently accessed via @link(#acquireFrame) and @link(#releaseFrame).
      Parameters:
      f - The container to be registered
    • getContext

      @Deprecated public static Container getContext()
      Deprecated.
      replaced by acquireFrame.
      Try to acquire exclusive access to a shared context previously registered with @link(#setFrame). If the frame is currently in use by someone else, the call will wait until the other owner is releases it.
      Returns:
      The container previously registered with setFrame. It will be returned in as clean a state as possible, with no children, and a new instance of @link(FlowLayout). null is returned if the call is interrupted.
      See Also:
    • setContext

      @Deprecated public static void setContext(Container c)
      Deprecated.
      replaced by @link(#setFrame)
      Set a context that can be subsequently accessed via @link(#acquireFrame) and @link(#releaseFrame).
      Parameters:
      c - The container to be registered
      Throws:
      ClassCastException - if the container being registered is not a frame
      See Also:
    • acquireFrame

      public static Frame acquireFrame() throws InterruptedException
      Try to acquire exclusive access to a shared context previously registered with @link(#setContext). If the context is currently in use by someone else, the call will wait until the other owner is releases it.
      Returns:
      The container previously registered with setContext. It will be returned in as clean a state as possible, with no children, and a new instance of @link(FlowLayout). If no frame has been registered, one has been created.
      Throws:
      InterruptedException - if the thread is interrupted while waiting for the context to become available.
      See Also:
    • restoreContext

      @Deprecated public static void restoreContext(Container c)
      Deprecated.
      replaced by releaseFrame.
      Release access to the previously acquired context. The context is reset to its state before @link(#acquireContext) was called, and made available to subsequent callers of @link(#acquireContext).
      Parameters:
      c - The result of previously calling @link(#acquireContext).
      Throws:
      IllegalStateException - if the argument is not the result of calling @link(#acquireFrame), or if it has already been released.
      ClassCastException - if the container is not a frame.
    • releaseFrame

      public static void releaseFrame(Frame f)
      Release access to the previously acquired frame. The frame is reset to its state before @link(#acquireFrame) was called, and made available to subsequent callers of @link(#acquireFrame).
      Parameters:
      f - The result of previously calling @link(#acquireFrame).
      Throws:
      IllegalStateException - if the argument is not the result of calling @link(#acquireFrame), or if it has already been released.
      See Also: