Class JXFrame
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- org.jdesktop.swingx.JXFrame
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible,javax.swing.RootPaneContainer,javax.swing.WindowConstants
- Direct Known Subclasses:
JXLoginPane.JXLoginFrame
@JavaBean public class JXFrame extends javax.swing.JFrame
JXFrameis an enhancedJFrame. WhileJXFramecan replace anyJFrame, it has features that make it particularly useful as the "main" frame for an application.Additional Features
Root pane:
JXFrameusesJXRootPaneas its default root pane. The frame provide several convenience methods to provide easy access to the additional features.Idle:
JXFrameoffers an idle timer. Registering aPropertyChangeListenerfor "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
JXFramecan 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.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJXFrame.StartPositionAn enumeration ofJXFramestarting locations.-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.ComponentglassPaneprivate booleanhasBeenVisibleprivate booleanidleprivate java.awt.event.AWTEventListeneridleListenerprivate longidleThresholdprivate javax.swing.TimeridleTimerprivate java.awt.event.AWTEventListenerkeyEventListenerprivate booleankeyPreviewprivate java.awt.CursorrealCursorprivate JXFrame.StartPositionstartPositionprivate booleanwaitCursorVisibleprivate booleanwaitingprivate java.awt.ComponentwaitPaneprivate booleanwaitPaneVisible-
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.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description JXFrame()Creates aJXFramewith no title and standard closing behavior.JXFrame(java.awt.GraphicsConfiguration gc)Creates aJXFramein the specifiedGraphicsConfigurationof a screen device, a blank title and default closing behaviour.JXFrame(java.lang.String title)Creates aJXFramewith the specified title and default closing behavior.JXFrame(java.lang.String title, boolean exitOnClose)Creates aJXFramewith the specified title and closing behavior.JXFrame(java.lang.String title, java.awt.GraphicsConfiguration gc)Creates aJXFramewith the specified title, the specifiedGraphicsConfigurationof a screen device and default closing behaviour.JXFrame(java.lang.String title, java.awt.GraphicsConfiguration gc, boolean exitOnClose)Creates aJXFramewith the specified title, GraphicsConfiguration and closing behavior.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.swing.JRootPanecreateRootPane()Overridden to create a JXRootPane.javax.swing.JButtongetCancelButton()Returns the value of the cancel button property from the underlyingJXRootPane.javax.swing.JButtongetDefaultButton()Returns the value of the default button property from the underlyingJRootPane.longgetIdleThreshold()Returns the amount of time that must elapse before the frame automatically enters an idle state.booleangetKeyPreview()Returns the value for the key preview.JXRootPanegetRootPaneExt()Return the extended root pane.JXFrame.StartPositiongetStartPosition()Returns the start position for this frame.JXStatusBargetStatusBar()Returns the value of the status bar property from the underlyingJXRootPane.javax.swing.JToolBargetToolBar()Returns the value of the tool bar property from the underlyingJXRootPane.java.awt.ComponentgetWaitPane()Returns the current wait pane for this frame.booleanisIdle()booleanisWaitCursorVisible()Returns the state of the wait cursor visibility.booleanisWaiting()Determines if the frame is in a wait state or not.booleanisWaitPaneVisible()Returns the current visibility of the wait glass pane.voidsetCancelButton(javax.swing.JButton button)Sets the cancel button property on the underlyingJXRootPane.voidsetCursor(java.awt.Cursor c)voidsetDefaultButton(javax.swing.JButton button)Sets the default button property on the underlyingJRootPane.voidsetIdle(boolean idle)Sets the frame into an idle state or restores the frame from an idle state.voidsetIdleThreshold(long threshold)Sets a threshold for user interaction before automatically placing the frame in an idle state.voidsetKeyPreview(boolean flag)If enabled theKeyListeners will receive a preview of theKeyEventprior to normal viewing.voidsetRootPane(javax.swing.JRootPane root)Overridden to make this public.voidsetStartPosition(JXFrame.StartPosition position)Sets the start position for this frame.voidsetStatusBar(JXStatusBar statusBar)Sets the status bar property on the underlyingJXRootPane.voidsetToolBar(javax.swing.JToolBar toolBar)Sets the tool bar property on the underlyingJXRootPane.voidsetVisible(boolean visible)voidsetWaitCursorVisible(boolean flag)Switches the display cursor to or from the wait cursor.voidsetWaiting(boolean waiting)Sets the frame into a wait state or restores the frame from a wait state.voidsetWaitPane(java.awt.Component c)Sets the component to use as a wait glass pane.voidsetWaitPaneVisible(boolean flag)Enabled or disabled the display of the normal or wait glass pane.-
Methods inherited from class javax.swing.JFrame
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
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
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
-
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, 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
-
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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
waitPane
private java.awt.Component waitPane
-
glassPane
private java.awt.Component glassPane
-
waitPaneVisible
private boolean waitPaneVisible
-
realCursor
private java.awt.Cursor realCursor
-
waitCursorVisible
private boolean waitCursorVisible
-
waiting
private boolean waiting
-
startPosition
private JXFrame.StartPosition startPosition
-
hasBeenVisible
private boolean hasBeenVisible
-
keyEventListener
private java.awt.event.AWTEventListener keyEventListener
-
keyPreview
private boolean keyPreview
-
idleListener
private java.awt.event.AWTEventListener idleListener
-
idleTimer
private javax.swing.Timer idleTimer
-
idleThreshold
private long idleThreshold
-
idle
private boolean idle
-
-
Constructor Detail
-
JXFrame
public JXFrame()
Creates aJXFramewith no title and standard closing behavior.
-
JXFrame
public JXFrame(java.lang.String title)
Creates aJXFramewith the specified title and default closing behavior.- Parameters:
title- the frame title
-
JXFrame
public JXFrame(java.awt.GraphicsConfiguration gc)
Creates aJXFramein the specifiedGraphicsConfigurationof a screen device, a blank title and default closing behaviour.- Parameters:
gc- theGraphicsConfigurationthat is used to construct the newFrame; ifgcisnull, the system defaultGraphicsConfigurationis assumed- Throws:
java.lang.IllegalArgumentException- ifgcis not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
-
JXFrame
public JXFrame(java.lang.String title, java.awt.GraphicsConfiguration gc)Creates aJXFramewith the specified title, the specifiedGraphicsConfigurationof a screen device and default closing behaviour.- Parameters:
title- the title to be displayed in the frame's border. Anullvalue is treated as an empty string, "".gc- theGraphicsConfigurationthat is used to construct the newJFramewith; ifgcisnull, the system defaultGraphicsConfigurationis assumed- Throws:
java.lang.IllegalArgumentException- ifgcis not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
-
JXFrame
public JXFrame(java.lang.String title, boolean exitOnClose)Creates aJXFramewith the specified title and closing behavior.- Parameters:
title- the frame titleexitOnClose-trueto override the default (JFrame) closing behavior and useEXIT_ON_CLOSEinstead;falseto use the default behavior
-
JXFrame
public JXFrame(java.lang.String title, java.awt.GraphicsConfiguration gc, boolean exitOnClose)Creates aJXFramewith the specified title, GraphicsConfiguration and closing behavior.- Parameters:
title- the frame titlegc- theGraphicsConfigurationof the target screen device. Ifgcisnull, the system defaultGraphicsConfigurationis assumed.exitOnClose-trueto override the default (JFrame) closing behavior and useEXIT_ON_CLOSEinstead;falseto use the default behavior- Throws:
java.lang.IllegalArgumentException- ifgcis not from a screen device.
-
-
Method Detail
-
setCancelButton
public void setCancelButton(javax.swing.JButton button)
Sets the cancel button property on the underlyingJXRootPane.- Parameters:
button- theJButtonwhich is to be the cancel button- See Also:
getCancelButton(),JXRootPane.setCancelButton(JButton)
-
getCancelButton
public javax.swing.JButton getCancelButton()
Returns the value of the cancel button property from the underlyingJXRootPane.- Returns:
- the
JButtonwhich is the cancel button - See Also:
setCancelButton(JButton),JXRootPane.getCancelButton()
-
setDefaultButton
public void setDefaultButton(javax.swing.JButton button)
Sets the default button property on the underlyingJRootPane.- Parameters:
button- theJButtonwhich is to be the default button- See Also:
getDefaultButton(),JRootPane.setDefaultButton(JButton)
-
getDefaultButton
public javax.swing.JButton getDefaultButton()
Returns the value of the default button property from the underlyingJRootPane.- Returns:
- the
JButtonwhich is the default button - See Also:
setDefaultButton(JButton),JRootPane.getDefaultButton()
-
setKeyPreview
public void setKeyPreview(boolean flag)
If enabled theKeyListeners will receive a preview of theKeyEventprior to normal viewing.- Parameters:
flag-trueto enable previewing;falseotherwise- See Also:
getKeyPreview(),Component.addKeyListener(KeyListener)
-
getKeyPreview
public final boolean getKeyPreview()
Returns the value for the key preview.- Returns:
- if
truepreviewing is enabled; otherwise it is not - See Also:
setKeyPreview(boolean)
-
setStartPosition
public void setStartPosition(JXFrame.StartPosition position)
Sets the start position for this frame. Setting this value only has an effect is the frame has never been displayed.- Parameters:
position- the position to display the frame at- See Also:
getStartPosition(),setVisible(boolean)
-
getStartPosition
public JXFrame.StartPosition getStartPosition()
Returns the start position for this frame.- Returns:
- the start position of the frame
- See Also:
setStartPosition(StartPosition)
-
setWaitCursorVisible
public void setWaitCursorVisible(boolean flag)
Switches the display cursor to or from the wait cursor.- Parameters:
flag-trueto enable the wait cursor;falseto enable the previous cursor- See Also:
isWaitCursorVisible(),Cursor.WAIT_CURSOR
-
isWaitCursorVisible
public boolean isWaitCursorVisible()
Returns the state of the wait cursor visibility.- Returns:
trueif the current cursor is the wait cursor;falseotherwise
-
setCursor
public void setCursor(java.awt.Cursor c)
- Overrides:
setCursorin classjava.awt.Window
-
setWaitPane
public void setWaitPane(java.awt.Component c)
Sets the component to use as a wait glass pane. This component is not part of the display hierarchy unlessisWaitPaneVisible() == true.- Parameters:
c- the wait glass pane for this frame- See Also:
getWaitPane(),setWaitPaneVisible(boolean)
-
getWaitPane
public java.awt.Component getWaitPane()
Returns the current wait pane for this frame. This component may or may not be part of the display hierarchy.- Returns:
- the current wait pane
- See Also:
setWaitPane(Component)
-
setWaitPaneVisible
public void setWaitPaneVisible(boolean flag)
Enabled or disabled the display of the normal or wait glass pane. Iftruethe wait pane is be displayed. Altering this property alters the display hierarchy.- Parameters:
flag-trueto display the wait glass pane;falseto display the normal glass pane- See Also:
isWaitPaneVisible(),setWaitPane(Component)
-
isWaitPaneVisible
public boolean isWaitPaneVisible()
Returns the current visibility of the wait glass pane.- Returns:
trueif the wait glass pane is visible;falseotherwise
-
setWaiting
public void setWaiting(boolean waiting)
Sets the frame into a wait state or restores the frame from a wait state.- Parameters:
waiting-trueto place the frame in a wait state;falseotherwise- See Also:
isWaiting(),setWaitCursorVisible(boolean),setWaitPaneVisible(boolean)
-
isWaiting
public boolean isWaiting()
Determines if the frame is in a wait state or not.- Returns:
trueif the frame is in the wait state;falseotherwise- See Also:
setWaiting(boolean)
-
setVisible
public void setVisible(boolean visible)
- Overrides:
setVisiblein classjava.awt.Window
-
isIdle
public boolean isIdle()
-
setIdle
public void setIdle(boolean idle)
Sets the frame into an idle state or restores the frame from an idle state.- Parameters:
idle-trueto place the frame in an idle state;falseotherwise- See Also:
isIdle(),setIdleThreshold(long)
-
setIdleThreshold
public void setIdleThreshold(long threshold)
Sets a threshold for user interaction before automatically placing the frame in an idle state.- Parameters:
threshold- the time (in milliseconds) to elapse before setting the frame idle- See Also:
getIdleThreshold(),setIdle(boolean)
-
getIdleThreshold
public long getIdleThreshold()
Returns the amount of time that must elapse before the frame automatically enters an idle state.- Returns:
- the time in milliseconds
-
setStatusBar
public void setStatusBar(JXStatusBar statusBar)
Sets the status bar property on the underlyingJXRootPane.- Parameters:
statusBar- theJXStatusBarwhich is to be the status bar- See Also:
getStatusBar(),JXRootPane.setStatusBar(JXStatusBar)
-
getStatusBar
public JXStatusBar getStatusBar()
Returns the value of the status bar property from the underlyingJXRootPane.- Returns:
- the
JXStatusBarwhich is the current status bar - See Also:
setStatusBar(JXStatusBar),JXRootPane.getStatusBar()
-
setToolBar
public void setToolBar(javax.swing.JToolBar toolBar)
Sets the tool bar property on the underlyingJXRootPane.- Parameters:
toolBar- theJToolBarwhich is to be the tool bar- See Also:
getToolBar(),JXRootPane.setToolBar(JToolBar)
-
getToolBar
public javax.swing.JToolBar getToolBar()
Returns the value of the tool bar property from the underlyingJXRootPane.- Returns:
- the
JToolBarwhich is the current tool bar - See Also:
setToolBar(JToolBar),JXRootPane.getToolBar()
-
createRootPane
protected javax.swing.JRootPane createRootPane()
Overridden to create a JXRootPane.- Overrides:
createRootPanein classjavax.swing.JFrame
-
setRootPane
public void setRootPane(javax.swing.JRootPane root)
Overridden to make this public.- Overrides:
setRootPanein classjavax.swing.JFrame
-
getRootPaneExt
public JXRootPane getRootPaneExt()
Return the extended root pane. If this frame doesn't contain an extended root pane the root pane should be accessed with getRootPane().- Returns:
- the extended root pane or null.
-
-