com.sun.javatest.util
Class MainFrame

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

public class MainFrame
extends java.lang.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 Summary
MainFrame()
           
 
Method Summary
static java.awt.Frame acquireFrame()
          Try to acquire exclusive access to a shared context previously registered with @link(#setContext).
static java.awt.Container getContext()
          Deprecated. replaced by acquireFrame.
static void releaseFrame(java.awt.Frame f)
          Release access to the previously acquired frame.
static void restoreContext(java.awt.Container c)
          Deprecated. replaced by releaseFrame.
static void setContext(java.awt.Container c)
          Deprecated. replaced by @link(#setFrame)
static void setFrame(java.awt.Frame f)
          Set a frame that can be subsequently accessed via @link(#acquireFrame) and @link(#releaseFrame).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MainFrame

public MainFrame()
Method Detail

setContext

public static void setContext(java.awt.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:
java.lang.ClassCastException - if the container being registered is not a frame
See Also:
getContext()

setFrame

public static void setFrame(java.awt.Frame f)
Set a frame that can be subsequently accessed via @link(#acquireFrame) and @link(#releaseFrame).

Parameters:
f - The container to be registered

getContext

public static java.awt.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(java.awt.Container)

acquireFrame

public static java.awt.Frame acquireFrame()
                                   throws java.lang.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:
java.lang.InterruptedException - if the thread is interrupted while waiting for the context to become available.
See Also:
releaseFrame(java.awt.Frame)

restoreContext

public static void restoreContext(java.awt.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:
java.lang.IllegalStateException - if the argument is not the result of calling @link(#acquireFrame), or if it has already been released.
java.lang.ClassCastException - if the container is not a frame.

releaseFrame

public static void releaseFrame(java.awt.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:
java.lang.IllegalStateException - if the argument is not the result of calling @link(#acquireFrame), or if it has already been released.
See Also:
acquireFrame()


Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.