public class JXFrame extends JFrame
JXFrame
is an enhanced JFrame
. While JXFrame
can
replace any JFrame
, it has features that make it particularly useful
as the "main" frame for an application.
Root pane: JXFrame
uses JXRootPane
as its default root pane.
The frame provide several convenience methods to provide easy access to the
additional features.
Idle: JXFrame
offers an idle timer. Registering a
PropertyChangeListener
for "idle" will notify when the
user has not interacted with the JVM. A primary use for this type of
functionality is to secure the application, blocking access and requiring the
user to login again.
Wait (busy) glass pane: The JXFrame
can be configured with an
alternate glass pane. Typically, this glass pane is used to notify the user
that the application is busy, but the glass pane could be for any purpose.
This secondary glass pane can be quickly enabled or disabled by
setting the wait pane visible.
Modifier and Type | Class and Description |
---|---|
static class |
JXFrame.StartPosition
An enumeration of
JXFrame starting locations. |
JFrame.AccessibleJFrame
Frame.AccessibleAWTFrame
Window.AccessibleAWTWindow, Window.Type
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
private Component |
glassPane |
private boolean |
hasBeenVisible |
private boolean |
idle |
private AWTEventListener |
idleListener |
private long |
idleThreshold |
private Timer |
idleTimer |
private AWTEventListener |
keyEventListener |
private boolean |
keyPreview |
private Cursor |
realCursor |
private JXFrame.StartPosition |
startPosition |
private boolean |
waitCursorVisible |
private boolean |
waiting |
private Component |
waitPane |
private boolean |
waitPaneVisible |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
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
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
JXFrame()
Creates a
JXFrame with no title and standard closing behavior. |
JXFrame(GraphicsConfiguration gc)
Creates a
JXFrame in the specified
GraphicsConfiguration of
a screen device, a blank title and default closing behaviour. |
JXFrame(String title)
Creates a
JXFrame with the specified title and default closing
behavior. |
JXFrame(String title,
boolean exitOnClose)
Creates a
JXFrame with the specified title and closing behavior. |
JXFrame(String title,
GraphicsConfiguration gc)
Creates a
JXFrame with the specified title, the
specified GraphicsConfiguration of a screen device and
default closing behaviour. |
JXFrame(String title,
GraphicsConfiguration gc,
boolean exitOnClose)
Creates a
JXFrame with the specified title, GraphicsConfiguration
and closing behavior. |
Modifier and Type | Method and Description |
---|---|
protected JRootPane |
createRootPane()
Overridden to create a JXRootPane.
|
JButton |
getCancelButton()
Returns the value of the cancel button property from the underlying
JXRootPane . |
JButton |
getDefaultButton()
Returns the value of the default button property from the underlying
JRootPane . |
long |
getIdleThreshold()
Returns the amount of time that must elapse before the frame
automatically enters an idle state.
|
boolean |
getKeyPreview()
Returns the value for the key preview.
|
JXRootPane |
getRootPaneExt()
Return the extended root pane.
|
JXFrame.StartPosition |
getStartPosition()
Returns the start position for this frame.
|
JXStatusBar |
getStatusBar()
Returns the value of the status bar property from the underlying
JXRootPane . |
JToolBar |
getToolBar()
Returns the value of the tool bar property from the underlying
JXRootPane . |
Component |
getWaitPane()
Returns the current wait pane for this frame.
|
boolean |
isIdle() |
boolean |
isWaitCursorVisible()
Returns the state of the wait cursor visibility.
|
boolean |
isWaiting()
Determines if the frame is in a wait state or not.
|
boolean |
isWaitPaneVisible()
Returns the current visibility of the wait glass pane.
|
void |
setCancelButton(JButton button)
Sets the cancel button property on the underlying
JXRootPane . |
void |
setCursor(Cursor c) |
void |
setDefaultButton(JButton button)
Sets the default button property on the underlying
JRootPane . |
void |
setIdle(boolean idle)
Sets the frame into an idle state or restores the frame from an idle state.
|
void |
setIdleThreshold(long threshold)
Sets a threshold for user interaction before automatically placing the
frame in an idle state.
|
void |
setKeyPreview(boolean flag)
If enabled the
KeyListener s will receive a preview of the KeyEvent prior to normal viewing. |
void |
setRootPane(JRootPane root)
Overridden to make this public.
|
void |
setStartPosition(JXFrame.StartPosition position)
Sets the start position for this frame.
|
void |
setStatusBar(JXStatusBar statusBar)
Sets the status bar property on the underlying
JXRootPane . |
void |
setToolBar(JToolBar toolBar)
Sets the tool bar property on the underlying
JXRootPane . |
void |
setVisible(boolean visible) |
void |
setWaitCursorVisible(boolean flag)
Switches the display cursor to or from the wait cursor.
|
void |
setWaiting(boolean waiting)
Sets the frame into a wait state or restores the frame from a wait state.
|
void |
setWaitPane(Component c)
Sets the component to use as a wait glass pane.
|
void |
setWaitPaneVisible(boolean flag)
Enabled or disabled the display of the normal or wait glass pane.
|
addImpl, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFont, postEvent
private boolean waitPaneVisible
private Cursor realCursor
private boolean waitCursorVisible
private boolean waiting
private JXFrame.StartPosition startPosition
private boolean hasBeenVisible
private AWTEventListener keyEventListener
private boolean keyPreview
private AWTEventListener idleListener
private long idleThreshold
private boolean idle
public JXFrame()
JXFrame
with no title and standard closing behavior.public JXFrame(String title)
JXFrame
with the specified title and default closing
behavior.title
- the frame titlepublic JXFrame(GraphicsConfiguration gc)
JXFrame
in the specified
GraphicsConfiguration
of
a screen device, a blank title and default closing behaviour.
gc
- the GraphicsConfiguration
that is used
to construct the new Frame
;
if gc
is null
, the system
default GraphicsConfiguration
is assumedIllegalArgumentException
- if gc
is not from
a screen device. This exception is always thrown when
GraphicsEnvironment.isHeadless() returns true.public JXFrame(String title, GraphicsConfiguration gc)
JXFrame
with the specified title, the
specified GraphicsConfiguration
of a screen device and
default closing behaviour.
title
- the title to be displayed in the
frame's border. A null
value is treated as
an empty string, "".gc
- the GraphicsConfiguration
that is used
to construct the new JFrame
with;
if gc
is null
, the system
default GraphicsConfiguration
is assumedIllegalArgumentException
- if gc
is not from
a screen device. This exception is always thrown when
GraphicsEnvironment.isHeadless() returns true.public JXFrame(String title, boolean exitOnClose)
JXFrame
with the specified title and closing behavior.title
- the frame titleexitOnClose
- true
to override the default (JFrame
) closing
behavior and use EXIT_ON_CLOSE
instead; false
to use the default behaviorpublic JXFrame(String title, GraphicsConfiguration gc, boolean exitOnClose)
JXFrame
with the specified title, GraphicsConfiguration
and closing behavior.title
- the frame titlegc
- the GraphicsConfiguration
of the target screen
device. If gc
is null
, the system
default GraphicsConfiguration
is assumed.exitOnClose
- true
to override the default (JFrame
)
closing behavior and use EXIT_ON_CLOSE
instead; false
to use the default behaviorIllegalArgumentException
- if gc
is not from a
screen device.public void setCancelButton(JButton button)
JXRootPane
.button
- the JButton
which is to be the cancel buttongetCancelButton()
,
JXRootPane.setCancelButton(JButton)
public JButton getCancelButton()
JXRootPane
.JButton
which is the cancel buttonsetCancelButton(JButton)
,
JXRootPane.getCancelButton()
public void setDefaultButton(JButton button)
JRootPane
.button
- the JButton
which is to be the default buttongetDefaultButton()
,
JRootPane.setDefaultButton(JButton)
public JButton getDefaultButton()
JRootPane
.JButton
which is the default buttonsetDefaultButton(JButton)
,
JRootPane.getDefaultButton()
public void setKeyPreview(boolean flag)
KeyListener
s will receive a preview of the KeyEvent
prior to normal viewing.flag
- true
to enable previewing; false
otherwisegetKeyPreview()
,
Component.addKeyListener(KeyListener)
public final boolean getKeyPreview()
true
previewing is enabled; otherwise it is notsetKeyPreview(boolean)
public void setStartPosition(JXFrame.StartPosition position)
position
- the position to display the frame atgetStartPosition()
,
setVisible(boolean)
public JXFrame.StartPosition getStartPosition()
setStartPosition(StartPosition)
public void setWaitCursorVisible(boolean flag)
flag
- true
to enable the wait cursor; false
to
enable the previous cursorisWaitCursorVisible()
,
Cursor.WAIT_CURSOR
public boolean isWaitCursorVisible()
true
if the current cursor is the wait cursor; false
otherwisepublic void setWaitPane(Component c)
isWaitPaneVisible() == true
.c
- the wait glass pane for this framegetWaitPane()
,
setWaitPaneVisible(boolean)
public Component getWaitPane()
setWaitPane(Component)
public void setWaitPaneVisible(boolean flag)
true
the wait pane is be displayed. Altering this property alters
the display hierarchy.flag
- true
to display the wait glass pane; false
to
display the normal glass paneisWaitPaneVisible()
,
setWaitPane(Component)
public boolean isWaitPaneVisible()
true
if the wait glass pane is visible; false
otherwisepublic void setWaiting(boolean waiting)
waiting
- true
to place the frame in a wait state; false
otherwiseisWaiting()
,
setWaitCursorVisible(boolean)
,
setWaitPaneVisible(boolean)
public boolean isWaiting()
true
if the frame is in the wait state; false
otherwisesetWaiting(boolean)
public void setVisible(boolean visible)
setVisible
in class Window
public boolean isIdle()
public void setIdle(boolean idle)
idle
- true
to place the frame in an idle state; false
otherwiseisIdle()
,
setIdleThreshold(long)
public void setIdleThreshold(long threshold)
threshold
- the time (in milliseconds) to elapse before setting the frame
idlegetIdleThreshold()
,
setIdle(boolean)
public long getIdleThreshold()
public void setStatusBar(JXStatusBar statusBar)
JXRootPane
.statusBar
- the JXStatusBar
which is to be the status bargetStatusBar()
,
JXRootPane.setStatusBar(JXStatusBar)
public JXStatusBar getStatusBar()
JXRootPane
.JXStatusBar
which is the current status barsetStatusBar(JXStatusBar)
,
JXRootPane.getStatusBar()
public void setToolBar(JToolBar toolBar)
JXRootPane
.toolBar
- the JToolBar
which is to be the tool bargetToolBar()
,
JXRootPane.setToolBar(JToolBar)
public JToolBar getToolBar()
JXRootPane
.JToolBar
which is the current tool barsetToolBar(JToolBar)
,
JXRootPane.getToolBar()
protected JRootPane createRootPane()
createRootPane
in class JFrame
public void setRootPane(JRootPane root)
setRootPane
in class JFrame
public JXRootPane getRootPaneExt()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses