Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
Frame
that provides support
for the Swing architecture. Most importantly it contains a JRootPane
as it's only top-level child, that manages the content pane, the menu and
a glass pane.
Also, unlike java.awt.Frame
s, JFrames support the
Swing Pluggable Look & Feel architecture.
Nested Class Summary | |
protected class |
|
Nested classes/interfaces inherited from class java.awt.Frame | |
Frame.AccessibleAWTFrame |
Nested classes/interfaces inherited from class java.awt.Window | |
Window.AccessibleAWTWindow |
Nested classes/interfaces inherited from class java.awt.Container | |
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component | |
Component.AccessibleAWTComponent , Component.BltBufferStrategy , Component.FlipBufferStrategy |
Field Summary | |
static int |
|
protected AccessibleContext |
|
protected JRootPane | |
protected boolean |
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 , NE_RESIZE_CURSOR , NORMAL , NW_RESIZE_CURSOR , N_RESIZE_CURSOR , SE_RESIZE_CURSOR , SW_RESIZE_CURSOR , S_RESIZE_CURSOR , TEXT_CURSOR , WAIT_CURSOR , W_RESIZE_CURSOR |
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver | |
ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH |
Fields inherited from interface javax.swing.WindowConstants | |
DISPOSE_ON_CLOSE , DO_NOTHING_ON_CLOSE , EXIT_ON_CLOSE , HIDE_ON_CLOSE |
Constructor Summary | |
| |
| |
|
Method Summary | |
protected void | |
protected JRootPane | |
protected void | |
AccessibleContext |
|
Container |
|
int |
|
Component |
|
JMenuBar | |
JLayeredPane |
|
Dimension |
|
JRootPane |
|
static boolean | |
protected boolean | |
protected String |
|
protected void |
|
protected void |
|
void | |
void |
|
void |
|
static void |
|
void |
|
void |
|
void |
|
void |
|
protected void |
|
protected void |
|
void |
Methods inherited from class java.awt.Frame | |
addNotify , getAccessibleContext , getCursorType , getExtendedState , getFrames , getIconImage , getMaximizedBounds , getMenuBar , getState , getTitle , isResizable , isUndecorated , paramString , remove , removeNotify , setCursor , setExtendedState , setIconImage , setMaximizedBounds , setMenuBar , setResizable , setState , setTitle , setUndecorated |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static final int EXIT_ON_CLOSE
A flag forsetDefaultCloseOperation(int)
, indicating that the application should be exited, when thisJFrame
is closed. Note that in version 1.4, the equivalent constant has been added toWindowConstants
.
- Field Value:
- 3
- Since:
- 1.3
protected AccessibleContext accessibleContext
The accessible context associated with this component. This is only set by subclasses.
- Since:
- 1.2
- See Also:
Component.getAccessibleContext()
public JFrame(GraphicsConfiguration gc)
Creates a new JFrame in the specifiedGraphicsConfiguration
and with an empty title.
- Parameters:
gc
- theGraphicsConfiguration
that is used for the newJFrame
- See Also:
Frame.Frame(GraphicsConfiguration)
public JFrame(String title)
Creates a newJFrame
with the specified title.
- Parameters:
title
- the frame title (null
permitted).
public JFrame(String title, GraphicsConfiguration gc)
Creates a new JFrame in the specifiedGraphicsConfiguration
and with the specified title.
- Parameters:
title
- the title for the newJFrame
gc
- theGraphicsConfiguration
that is used for the newJFrame
protected void addImpl(Component comp, Object constraints, int index)
This method is called by all theadd()
methods to perform the actual adding of the component. Subclasses who wish to perform their own processing when a component is added should override this method. Any subclass doing this must call the superclass version of this method in order to ensure proper functioning of the container.
- Parameters:
comp
- The component to be added.constraints
- The layout constraints for this component, ornull
if there are no constraints.index
- The index in the component list to insert this child at, or -1 to add at the end of the list.
- Throws:
ArrayIndexOutOfBoundsException
- If the specified index is invalid.
public AccessibleContext getAccessibleContext()
Returns the object that provides accessibility features for thisJFrame
.
- Specified by:
- getAccessibleContext in interface Accessible
- Overrides:
- getAccessibleContext in interface Frame
- Returns:
- The accessible context (an instance of
JFrame.AccessibleJFrame
).
public Container getContentPane()
getContentPane
- Specified by:
- getContentPane in interface RootPaneContainer
public int getDefaultCloseOperation()
Returns a code for the default operation when the frame is closed. The default value isWindowConstants.HIDE_ON_CLOSE
.
- See Also:
setDefaultCloseOperation(int)
public Component getGlassPane()
getGlassPane
- Specified by:
- getGlassPane in interface RootPaneContainer
public JLayeredPane getLayeredPane()
getLayeredPane
- Specified by:
- getLayeredPane in interface RootPaneContainer
public Dimension getPreferredSize()
Returns the preferred size of this container.
- Overrides:
- getPreferredSize in interface Container
- Returns:
- The preferred size of this container.
public JRootPane getRootPane()
getRootPane
- Specified by:
- getRootPane in interface RootPaneContainer
protected String paramString()
Returns a string describing the attributes for theJFrame
, for use in debugging. The return value is guaranteed to be non-null
, but the format may vary between implementations.
- Overrides:
- paramString in interface Frame
- Returns:
- A string describing the attributes of the
JFrame
.
protected void processKeyEvent(KeyEvent e)
Called when a key event is dispatched and component events are enabled. This method passes the event along to any listeners that are attached.
- Overrides:
- processKeyEvent in interface Component
- Parameters:
e
- theKeyEvent
to process
- Throws:
NullPointerException
- if e is null
- Since:
- 1.1
protected void processWindowEvent(WindowEvent e)
Dispatches this event to any listeners that are listening forWindowEvents
on this window. This method only gets invoked if it is enabled viaenableEvents()
or if a listener has been added.
- Overrides:
- processWindowEvent in interface Window
- Parameters:
public void remove(Component comp)
Removes the specified component from this container.
- Parameters:
comp
- The component to remove from this container.
public void setContentPane(Container contentPane)
setContentPane
- Specified by:
- setContentPane in interface RootPaneContainer
- Parameters:
contentPane
- TODO
public void setDefaultCloseOperation(int operation)
Sets the default operation that is performed when this frame is closed. The default isHIDE_ON_CLOSE
. WhenEXIT_ON_CLOSE
is specified this method callsSecurityManager.checkExit(0)
which might throw aSecurityException
.
- Parameters:
operation
- a code for the operation (one of:WindowConstants.DO_NOTHING_ON_CLOSE
,WindowConstants.HIDE_ON_CLOSE
,WindowConstants.DISPOSE_ON_CLOSE
andWindowConstants.EXIT_ON_CLOSE
).
- Throws:
IllegalArgumentException
- ifoperation
is not one of the specified codes.
- See Also:
getDefaultCloseOperation()
public void setGlassPane(Component glassPane)
setGlassPane
- Specified by:
- setGlassPane in interface RootPaneContainer
- Parameters:
glassPane
- TODO
public void setLayeredPane(JLayeredPane layeredPane)
setLayeredPane
- Specified by:
- setLayeredPane in interface RootPaneContainer
- Parameters:
layeredPane
- TODO
public void setLayout(LayoutManager manager)
Sets the layout manager for this container to the specified layout manager.
- Parameters:
public void update(Graphics g)
Updates this container. The implementation of this method in this class forwards to any lightweight components in this container. If this method is subclassed, this method should still be invoked as a superclass method so that lightweight components are properly drawn.
- Parameters:
g
- The graphics context for this update.