edu.neu.ccs.gui
Class JPTFrame

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended byedu.neu.ccs.gui.JPTFrame
All Implemented Interfaces:
Accessible, ImageObserver, JPTConstants, MenuContainer, RootPaneContainer, Serializable, SwingConstants, WindowConstants
Direct Known Subclasses:
ConsoleWindow

public class JPTFrame
extends JFrame
implements JPTConstants

JPTFrame extends the Java JFrame class for the following purposes.

This class adds two new default close operations to the JFrame class:

We now make some comments that explain the historical evolution of the methods in this class.

The static convenience methods createQuickJPTFrame may be used to create and display a JPTFrame that is automatically packed and placed in a desired location.

In version 2.3.2, the various createQuickJPTFrame methods were changed to accept a general Object rather than requiring a Component. The object is converted into a component using the tools of ComponentFactory.

In version 2.3.4, methods named frame were introduced as less verbose versions of createQuickJPTFrame. At the same time, these methods make the object being framed the first argument which is, in retrospect, a much more natural design.

The same static frame methods have also been introduced into the class JPF as convenience methods for experimentation.

The class DisplayPanel has a parallel set of member frame methods that permit a DisplayPanel to frame itself. We call this ability self actualization.

In 2.4.0, the methods normal, iconify, maximize, and toggle were introduced to permit easy algorithmic control of whether a frame is in its normal state, is maximized, or is iconfied.

In 2.7.0, public static methods were added to permit access to the counter object that counts the number of open JPTFrame objects. The purpose of this change is to support DirectApplet class. The difficulty resolved is this. An applet can open frames. The JPT policy is to exit if the last open frame is closed. However, in prior releases, this did not count the applet itself. Hence, if the applet opened a frame and the user closed the frame then the applet itself might exit. By making the counter increment and decrement methods public, an applet can add itself into the count of open frames on initialization and remove itself when it is destroyed. It is a serious error to use these static methods for any other purpose.

Since:
1.0
Version:
2.7.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  int closeOperation
          The window closing operation for this frame.
protected static XInt counter
          Shared counter of JPTFrames in existence.
static int DEFAULT_CLOSE_OPERATION
          The default window closing operation for a JPTFrame.
static int EXIT_ON_CLOSE
          Value designating that the running application should be exited when this frame is disposed.
static int EXIT_ON_CLOSE_IF_LAST
          Value designating that the running application should be exited when the last JPTFrame is disposed.
private static Insets INSETS
          The default insets for the frame in the screen window, namely, 50, 50, 50, 50.
protected  Insets screen_insets
          The current insets to use in setLocation calls that do not provide explicit insets.
 
Fields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Window
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface edu.neu.ccs.util.JPTConstants
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JPTFrame()
          Constructs a frame with no title.
JPTFrame(String title)
          Constructs a frame with the given title.
 
Method Summary
 void addNotify()
          Resizes the frame upon creation of its peer window to make its contents the proper size regardless of platform specific insets size.
 void center()
          Centers the frame on the user screen relative to the current screen insets.
static JPTFrame createQuickJPTFrame(String title, Object object)
          Returns a new JPTFrame with the given title and content pane that is packed and centered on the screen.
static JPTFrame createQuickJPTFrame(String title, Object object, Insets insets)
          Returns a new JPTFrame with the given title and content pane that is packed and centered on the screen; the given insets replace the current insets for future calls of setLocation(int) on the frame.
static JPTFrame createQuickJPTFrame(String title, Object object, int location)
          Returns a new JPTFrame with the given title and content pane that is packed and located on the screen in the given screen location.
static JPTFrame createQuickJPTFrame(String title, Object object, int location, Insets insets)
          Returns a new JPTFrame with the given title and content pane that is packed and located on the screen in the given screen location; the given insets bound the frame away from the borders of the screen and also replace the current insets for future calls of setLocation(int) on the frame.
static JPTFrame createQuickJPTFrame(String title, Object object, LayoutManager layout)
          Returns a new JPTFrame with the given title, content pane, and layout manager that is packed and centered on the screen.
static JPTFrame createQuickJPTFrame(String title, Object object, LayoutManager layout, Insets insets)
          Returns a new JPTFrame with the given title, content pane, and layout manager, that is packed and centered on the screen; the given insets replace the current insets for future calls of setLocation(int) on the frame.
static JPTFrame createQuickJPTFrame(String title, Object object, LayoutManager layout, int location)
          Returns a new JPTFrame with the given title, content pane, and layout manager, that is packed and located on the screen in the given screen location.
static JPTFrame createQuickJPTFrame(String title, Object object, LayoutManager layout, int location, Insets insets)
          Returns a new JPTFrame with the given title, content pane, and layout manager, that is packed and located on the screen in the given screen location; the given insets bound the frame away from the borders of the screen and also replace the current insets for future calls of setLocation(int) on the frame.
static void decrementCounter()
          Decrements the shared counter object that counts the number of open JPTFrame and DirectApplet objects.
 void dispose()
          Disposes of the resources used by this frame and decrements the count of JPTFrame and DirectApplet objects in existence.
static JPTFrame frame(Object object)
          Returns a new JPTFrame with the given content pane and blank title that is packed and centered on the screen.
static JPTFrame frame(Object object, int location)
          Returns a new JPTFrame with the given content pane and blank title that is packed and located on the screen in the given screen location.
static JPTFrame frame(Object object, String title)
          Returns a new JPTFrame with the given content pane and title that is packed and centered on the screen.
static JPTFrame frame(Object object, String title, Insets insets)
          Returns a new JPTFrame with the given content pane and title that is packed and centered on the screen; the given insets replace the current insets for future calls of setLocation(int) on the frame.
static JPTFrame frame(Object object, String title, int location)
          Returns a new JPTFrame with the given content pane and title that is packed and located on the screen in the given screen location.
static JPTFrame frame(Object object, String title, int location, Insets insets)
          Returns a new JPTFrame with the given content pane and title that is packed and located on the screen in the given screen location; the given insets bound the frame away from the borders of the screen and also replace the current insets for future calls of setLocation(int) on the frame.
protected static XInt getCounter()
          Returns the shared counter object that counts the number of open JPTFrame and DirectApplet objects.
 int getDefaultCloseOperation()
          Returns the window close operation for this frame.
static int getJPTFrameCount()
          Returns the number of JPTFrames in existence.
 Insets getScreenInsets()
          Returns a copy of the current screen insets used in calls to setLocation(int).
 void iconify()
          Set this frame to its ICONIFIED state.
static void incrementCounter()
          Increments the shared counter object that counts the number of open JPTFrame and DirectApplet objects.
 void installWindowAdapter()
          Installs the window adapter for this frame.
 void maximize()
          Set this frame to its MAXIMIZED_BOTH state.
 void normal()
          Set this frame to its NORMAL state.
 void setDefaultCloseOperation(int operation)
          Sets the window closing operation to the operation specified by the given value.
 void setLocation(int location)
          Sets the location of this frame on the user screen to the location representing the logical screen location of the given compass direction; uses the current screen insets saved with this frame.
 void setLocation(int location, Insets insets)
          Sets the location of this frame on the user screen to the location representing the logical screen location of the given compass direction; the given insets bound the frame away from the borders of the screen and also replace the current screen insets for future calls of setLocation(int) on the frame.
 void toggle()
          If the current state of the frame is not normal, then make it normal otherwise iconify.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

EXIT_ON_CLOSE

public static final int EXIT_ON_CLOSE
Value designating that the running application should be exited when this frame is disposed. This constant, EXIT_ON_CLOSE, is mentioned in the API documentation for JDK v1.3, but is not implemented in any version of the JDK.

See Also:
setDefaultCloseOperation(int), Constant Field Values

EXIT_ON_CLOSE_IF_LAST

public static final int EXIT_ON_CLOSE_IF_LAST
Value designating that the running application should be exited when the last JPTFrame is disposed.

See Also:
setDefaultCloseOperation(int), Constant Field Values

DEFAULT_CLOSE_OPERATION

public static final int DEFAULT_CLOSE_OPERATION
The default window closing operation for a JPTFrame.

See Also:
setDefaultCloseOperation(int), Constant Field Values

INSETS

private static final Insets INSETS
The default insets for the frame in the screen window, namely, 50, 50, 50, 50.


counter

protected static XInt counter
Shared counter of JPTFrames in existence.


closeOperation

protected int closeOperation
The window closing operation for this frame.

See Also:
setDefaultCloseOperation(int)

screen_insets

protected Insets screen_insets
The current insets to use in setLocation calls that do not provide explicit insets.

Constructor Detail

JPTFrame

public JPTFrame()
Constructs a frame with no title.

See Also:
JPTFrame(String)

JPTFrame

public JPTFrame(String title)
Constructs a frame with the given title.

Parameters:
title - the title for this frame
See Also:
JPTFrame()
Method Detail

center

public void center()
Centers the frame on the user screen relative to the current screen insets.

See Also:
Component.setLocation(int, int)

setLocation

public void setLocation(int location)

Sets the location of this frame on the user screen to the location representing the logical screen location of the given compass direction; uses the current screen insets saved with this frame.

For best results, this method should be called after the JPTFrame is made visible. The reason for this is that, in making the frame visible, Java calls the method addNotify() and this method has been overridden in this class to adjust the frame size to take into account the insets of the native window in order to get the true size.

The methods createQuickJPTFrame are designed to set the location after the frame is made visible.

This method does not anchor this frame in the given logical position; calling this method leads to a call of the standard setLocation(int, int) method.

The location is given by one of the following constants in the interface SwingConstants that are included for convenience in the interface JPTConstants as well:

The DEFAULT location is the CENTER location.

If the given compass direction is not valid, the location is set to the DEFAULT location. This is a change in how to handle an erroneous parameter that was introduced in version 2.3.

Parameters:
location - the compass direction representing the desired location
Since:
1.1
See Also:
setLocation(int, Insets), center(), Component.setLocation(int, int), JPTConstants.DEFAULT

setLocation

public void setLocation(int location,
                        Insets insets)

Sets the location of this frame on the user screen to the location representing the logical screen location of the given compass direction; the given insets bound the frame away from the borders of the screen and also replace the current screen insets for future calls of setLocation(int) on the frame.

For best results, this method should be called after the JPTFrame is made visible. The reason for this is that, in making the frame visible, Java calls the method addNotify() and this method has been overridden in this class to adjust the frame size to take into account the insets of the native window in order to get the true size.

The methods createQuickJPTFrame are designed to set the location after the frame is made visible.

This method does not anchor this frame in the given logical position; calling this method leads to a call of the standard setLocation(int, int) method.

The location is given by one of the following constants in the interface SwingConstants that are included for convenience in the interface JPTConstants as well:

The DEFAULT location is the CENTER location.

If the given compass direction is not valid, the location is set to the DEFAULT location. This is a change in how to handle an erroneous parameter that was introduced in version 2.3.

The insets provide a margin from the edge of the screen so the frame will avoid being placed underneath OS objects such as menu bars or program selection widgets.

If the given insets is null, then the current screen insets revert to the default of 50, 50, 50, 50.

Parameters:
location - the compass direction representing the desired location
insets - the screen insets to use to adjust the location
Since:
1.1
See Also:
setLocation(int), center(), Component.setLocation(int, int), JPTConstants.DEFAULT

getScreenInsets

public Insets getScreenInsets()
Returns a copy of the current screen insets used in calls to setLocation(int).

Returns:
the current screen insets
Since:
2.3
See Also:
setLocation(int)

addNotify

public void addNotify()
Resizes the frame upon creation of its peer window to make its contents the proper size regardless of platform specific insets size.


setDefaultCloseOperation

public void setDefaultCloseOperation(int operation)

Sets the window closing operation to the operation specified by the given value.

If the given value is not valid, the current window closing operation is not changed.

Parameters:
operation - the value of the operation to perform when the window is closed
See Also:
getDefaultCloseOperation(), WindowConstants.DO_NOTHING_ON_CLOSE, WindowConstants.HIDE_ON_CLOSE, WindowConstants.DISPOSE_ON_CLOSE, EXIT_ON_CLOSE, EXIT_ON_CLOSE_IF_LAST, JPTConstants.DEFAULT

getDefaultCloseOperation

public int getDefaultCloseOperation()
Returns the window close operation for this frame.

See Also:
setDefaultCloseOperation(int), WindowConstants.DO_NOTHING_ON_CLOSE, WindowConstants.HIDE_ON_CLOSE, WindowConstants.DISPOSE_ON_CLOSE, EXIT_ON_CLOSE, EXIT_ON_CLOSE_IF_LAST

getJPTFrameCount

public static int getJPTFrameCount()
Returns the number of JPTFrames in existence.

See Also:
EXIT_ON_CLOSE_IF_LAST

dispose

public void dispose()

Disposes of the resources used by this frame and decrements the count of JPTFrame and DirectApplet objects in existence.


normal

public void normal()

Set this frame to its NORMAL state.

Equivalent to the call setExtendedState(JFrame.NORMAL).


iconify

public void iconify()

Set this frame to its ICONIFIED state.

Equivalent to the call setExtendedState(JFrame.ICONIFIED).


maximize

public void maximize()

Set this frame to its MAXIMIZED_BOTH state.

Equivalent to the call setExtendedState(JFrame.MAXIMIZED_BOTH).


toggle

public void toggle()

If the current state of the frame is not normal, then make it normal otherwise iconify.


createQuickJPTFrame

public static JPTFrame createQuickJPTFrame(String title,
                                           Object object)

Returns a new JPTFrame with the given title and content pane that is packed and centered on the screen.

If the given object is null, no contents are added to the frame.

The layout of the content pane is set to CenterLayout.

Parameters:
title - the title for the frame
object - the object to frame

createQuickJPTFrame

public static JPTFrame createQuickJPTFrame(String title,
                                           Object object,
                                           int location)

Returns a new JPTFrame with the given title and content pane that is packed and located on the screen in the given screen location.

If the given object is null, no contents are added to the frame.

The layout of the content pane is set to CenterLayout.

The location is given by one of the following constants in the interface SwingConstants that are included for convenience in the interface JPTConstants as well:

Parameters:
title - the title for the frame
object - the object to frame
location - the compass direction representing the desired location

createQuickJPTFrame

public static JPTFrame createQuickJPTFrame(String title,
                                           Object object,
                                           Insets insets)

Returns a new JPTFrame with the given title and content pane that is packed and centered on the screen; the given insets replace the current insets for future calls of setLocation(int) on the frame.

If the given object is null, no contents are added to the frame.

The layout of the content pane is set to CenterLayout.

The insets provide a margin from the edge of the screen so the frame will avoid being placed underneath OS objects such as menu bars or program selection widgets.

If the given insets is null, then the insets are set to the default of 50, 50, 50, 50.

Parameters:
title - the title for the frame
object - the object to frame
insets - the screen insets to use to adjust the location

createQuickJPTFrame

public static JPTFrame createQuickJPTFrame(String title,
                                           Object object,
                                           int location,
                                           Insets insets)

Returns a new JPTFrame with the given title and content pane that is packed and located on the screen in the given screen location; the given insets bound the frame away from the borders of the screen and also replace the current insets for future calls of setLocation(int) on the frame.

If the given object is null, no contents are added to the frame.

The layout of the content pane is set to CenterLayout.

The location is given by one of the following constants in the interface SwingConstants that are included for convenience in the interface JPTConstants as well:

The insets provide a margin from the edge of the screen so the frame will avoid being placed underneath OS objects such as menu bars or program selection widgets.

If the given insets is null, then the insets are set to the default of 50, 50, 50, 50.

Parameters:
title - the title for the frame
object - the object to frame
location - the compass direction representing the desired location
insets - the screen insets to use to adjust the location

createQuickJPTFrame

public static JPTFrame createQuickJPTFrame(String title,
                                           Object object,
                                           LayoutManager layout)

Returns a new JPTFrame with the given title, content pane, and layout manager that is packed and centered on the screen.

If the given object is null, no contents are added to the frame.

If the given layout manager is null, the default layout for the content pane of a JFrame is used.

Parameters:
title - the title for the frame
object - the object to frame
layout - the layout manager for the content pane

createQuickJPTFrame

public static JPTFrame createQuickJPTFrame(String title,
                                           Object object,
                                           LayoutManager layout,
                                           int location)

Returns a new JPTFrame with the given title, content pane, and layout manager, that is packed and located on the screen in the given screen location.

If the given object is null, no contents are added to the frame.

If the given layout manager is null, the default layout for the content pane of a JFrame is used.

The location is given by one of the following constants in the interface SwingConstants that are included for convenience in the interface JPTConstants as well:

Parameters:
title - the title for the frame
object - the object to frame
layout - the layout manager for the content pane
location - the compass direction representing the desired location

createQuickJPTFrame

public static JPTFrame createQuickJPTFrame(String title,
                                           Object object,
                                           LayoutManager layout,
                                           Insets insets)

Returns a new JPTFrame with the given title, content pane, and layout manager, that is packed and centered on the screen; the given insets replace the current insets for future calls of setLocation(int) on the frame.

If the given object is null, no contents are added to the frame.

If the given layout manager is null, the default layout for the content pane of a JFrame is used.

The insets provide a margin from the edge of the screen so the frame will avoid being placed underneath OS objects such as menu bars or program selection widgets.

If the given insets is null, then the insets are set to the default of 50, 50, 50, 50.

Parameters:
title - the title for the frame
object - the object to frame
layout - the layout manager for the content pane
insets - the screen insets to use to adjust the location

createQuickJPTFrame

public static JPTFrame createQuickJPTFrame(String title,
                                           Object object,
                                           LayoutManager layout,
                                           int location,
                                           Insets insets)

Returns a new JPTFrame with the given title, content pane, and layout manager, that is packed and located on the screen in the given screen location; the given insets bound the frame away from the borders of the screen and also replace the current insets for future calls of setLocation(int) on the frame.

If the given object is null, no contents are added to the frame.

If the given layout manager is null, the default layout for the content pane of a JFrame is used.

The location is given by one of the following constants in the interface SwingConstants that are included for convenience in the interface JPTConstants as well:

The insets provide a margin from the edge of the screen so the frame will avoid being placed underneath OS objects such as menu bars or program selection widgets.

If the given insets is null, then the insets are set to the default of 50, 50, 50, 50.

Parameters:
title - the title for the frame
object - the object to frame
layout - the layout manager for the content pane
location - the compass direction representing the desired location
insets - the screen insets to use to adjust the location

frame

public static JPTFrame frame(Object object)

Returns a new JPTFrame with the given content pane and blank title that is packed and centered on the screen.

If the given object is null, no contents are added to the frame.

The layout of the content pane is set to CenterLayout.

The method call frame(object) is the same as the method call createQuickJPTFrame("",object).

Parameters:
object - the object to frame

frame

public static JPTFrame frame(Object object,
                             int location)

Returns a new JPTFrame with the given content pane and blank title that is packed and located on the screen in the given screen location.

If the given object is null, no contents are added to the frame.

The layout of the content pane is set to CenterLayout.

The location is given by one of the following constants in the interface SwingConstants that are included for convenience in the interface JPTConstants as well:

The method call frame(object,location) is the same as the method call createQuickJPTFrame("",object,location).

Parameters:
object - the object to frame
location - the compass direction representing the desired location

frame

public static JPTFrame frame(Object object,
                             String title)

Returns a new JPTFrame with the given content pane and title that is packed and centered on the screen.

If the given object is null, no contents are added to the frame.

The layout of the content pane is set to CenterLayout.

This method is the same as createQuickJPTFrame(String,Object) but places the Object argument first and is less verbose.

Parameters:
object - the object to frame
title - the title for the frame

frame

public static JPTFrame frame(Object object,
                             String title,
                             int location)

Returns a new JPTFrame with the given content pane and title that is packed and located on the screen in the given screen location.

If the given object is null, no contents are added to the frame.

The layout of the content pane is set to CenterLayout.

The location is given by one of the following constants in the interface SwingConstants that are included for convenience in the interface JPTConstants as well:

This method is the same as createQuickJPTFrame(String,Object,int) but places the Object argument first and is less verbose.

Parameters:
object - the object to frame
title - the title for the frame
location - the compass direction representing the desired location

frame

public static JPTFrame frame(Object object,
                             String title,
                             Insets insets)

Returns a new JPTFrame with the given content pane and title that is packed and centered on the screen; the given insets replace the current insets for future calls of setLocation(int) on the frame.

If the given object is null, no contents are added to the frame.

The layout of the content pane is set to CenterLayout.

The insets provide a margin from the edge of the screen so the frame will avoid being placed underneath OS objects such as menu bars or program selection widgets.

If the given insets is null, then the insets are set to the default of 50, 50, 50, 50.

This method is the same as createQuickJPTFrame(String,Object,Insets) but places the Object argument first and is less verbose.

Parameters:
object - the object to frame
title - the title for the frame
insets - the screen insets to use to adjust the location

frame

public static JPTFrame frame(Object object,
                             String title,
                             int location,
                             Insets insets)

Returns a new JPTFrame with the given content pane and title that is packed and located on the screen in the given screen location; the given insets bound the frame away from the borders of the screen and also replace the current insets for future calls of setLocation(int) on the frame.

If the given object is null, no contents are added to the frame.

The layout of the content pane is set to CenterLayout.

The location is given by one of the following constants in the interface SwingConstants that are included for convenience in the interface JPTConstants as well:

The insets provide a margin from the edge of the screen so the frame will avoid being placed underneath OS objects such as menu bars or program selection widgets.

If the given insets is null, then the insets are set to the default of 50, 50, 50, 50.

This method is the same as createQuickJPTFrame(String,Object,int,Insets) but places the Object argument first and is less verbose.

Parameters:
object - the object to frame
title - the title for the frame
location - the compass direction representing the desired location
insets - the screen insets to use to adjust the location

getCounter

protected static XInt getCounter()

Returns the shared counter object that counts the number of open JPTFrame and DirectApplet objects.


incrementCounter

public static void incrementCounter()

Increments the shared counter object that counts the number of open JPTFrame and DirectApplet objects.

This method though public is intended for internal use by JPT and should not be used for other purposes.


decrementCounter

public static void decrementCounter()

Decrements the shared counter object that counts the number of open JPTFrame and DirectApplet objects.

This method though public is intended for internal use by JPT and should not be used for other purposes.


installWindowAdapter

public void installWindowAdapter()
Installs the window adapter for this frame.