Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.swing
Class JFrame  view JFrame download JFrame.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, RootPaneContainer, java.io.Serializable, WindowConstants

public class JFrame
extends java.awt.Frame
implements WindowConstants, RootPaneContainer, javax.accessibility.Accessible

A window that supports window decorations (titlebar and borders). This is an extension of java.awt.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.Frames, JFrames support the Swing Pluggable Look & Feel architecture.


Nested Class Summary
protected  class JFrame.AccessibleJFrame
          Provides accessibility support for JFrames.
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  javax.accessibility.AccessibleContext accessibleContext
           
private  int close_action
           
private static boolean defaultLookAndFeelDecorated
           
static int EXIT_ON_CLOSE
          A flag for setDefaultCloseOperation(int) 55 , indicating that the application should be exited, when this JFrame is closed.
protected  JRootPane rootPane
           
protected  boolean rootPaneCheckingEnabled
           
private static long serialVersionUID
           
 
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 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
JFrame()
           
JFrame(java.awt.GraphicsConfiguration gc)
          Creates a new JFrame in the specified java.awt.GraphicsConfiguration and with an empty title.
JFrame(java.lang.String title)
           
JFrame(java.lang.String title, java.awt.GraphicsConfiguration gc)
          Creates a new JFrame in the specified java.awt.GraphicsConfiguration and with the specified title.
 
Method Summary
protected  void addImpl(java.awt.Component comp, java.lang.Object constraints, int index)
          This method is called by all the add() methods to perform the actual adding of the component.
protected  JRootPane createRootPane()
           
protected  void frameInit()
           
 javax.accessibility.AccessibleContext getAccessibleContext()
          If a component supports the Accessibility API then this method should not return null.
 java.awt.Container getContentPane()
          getContentPane
 int getDefaultCloseOperation()
           
 java.awt.Component getGlassPane()
          getGlassPane
 JMenuBar getJMenuBar()
           
 JLayeredPane getLayeredPane()
          getLayeredPane
 java.awt.Dimension getPreferredSize()
          Returns the preferred size of this container.
 JRootPane getRootPane()
          getRootPane
static boolean isDefaultLookAndFeelDecorated()
           
protected  boolean isRootPaneCheckingEnabled()
           
protected  java.lang.String paramString()
          Returns a debugging string describing this window.
protected  void processKeyEvent(java.awt.event.KeyEvent e)
          Called when a key event is dispatched and component events are enabled.
protected  void processWindowEvent(java.awt.event.WindowEvent e)
          Dispatches this event to any listeners that are listening for WindowEvents on this window.
 void remove(java.awt.Component comp)
          Removes the specified component from this container.
 void setContentPane(java.awt.Container contentPane)
          setContentPane
 void setDefaultCloseOperation(int operation)
          Defines what happens when this frame is closed.
static void setDefaultLookAndFeelDecorated(boolean decorated)
           
 void setGlassPane(java.awt.Component glassPane)
          setGlassPane
 void setJMenuBar(JMenuBar menubar)
           
 void setLayeredPane(JLayeredPane layeredPane)
          setLayeredPane
 void setLayout(java.awt.LayoutManager manager)
          Sets the layout manager for this container to the specified layout manager.
protected  void setRootPane(JRootPane root)
           
protected  void setRootPaneCheckingEnabled(boolean enabled)
           
 void update(java.awt.Graphics g)
          Updates this container.
 
Methods inherited from class java.awt.Frame
addNotify, 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
addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getGraphicsConfiguration, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, 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, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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
A flag for setDefaultCloseOperation(int) 55 , indicating that the application should be exited, when this JFrame is closed.

Since:
1.3
See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

defaultLookAndFeelDecorated

private static boolean defaultLookAndFeelDecorated

close_action

private int close_action

accessibleContext

protected javax.accessibility.AccessibleContext accessibleContext

rootPane

protected JRootPane rootPane

rootPaneCheckingEnabled

protected boolean rootPaneCheckingEnabled
Constructor Detail

JFrame

public JFrame()

JFrame

public JFrame(java.lang.String title)

JFrame

public JFrame(java.awt.GraphicsConfiguration gc)
Creates a new JFrame in the specified java.awt.GraphicsConfiguration and with an empty title.


JFrame

public JFrame(java.lang.String title,
              java.awt.GraphicsConfiguration gc)
Creates a new JFrame in the specified java.awt.GraphicsConfiguration and with the specified title.

Method Detail

frameInit

protected void frameInit()

getPreferredSize

public java.awt.Dimension getPreferredSize()
Description copied from class: java.awt.Container
Returns the preferred size of this container.


getJMenuBar

public JMenuBar getJMenuBar()

setJMenuBar

public void setJMenuBar(JMenuBar menubar)

setLayout

public void setLayout(java.awt.LayoutManager manager)
Description copied from class: java.awt.Container
Sets the layout manager for this container to the specified layout manager.


setLayeredPane

public void setLayeredPane(JLayeredPane layeredPane)
Description copied from interface: RootPaneContainer
setLayeredPane

Specified by:
setLayeredPane in interface RootPaneContainer

getLayeredPane

public JLayeredPane getLayeredPane()
Description copied from interface: RootPaneContainer
getLayeredPane

Specified by:
getLayeredPane in interface RootPaneContainer

getRootPane

public JRootPane getRootPane()
Description copied from interface: RootPaneContainer
getRootPane

Specified by:
getRootPane in interface RootPaneContainer

setRootPane

protected void setRootPane(JRootPane root)

createRootPane

protected JRootPane createRootPane()

getContentPane

public java.awt.Container getContentPane()
Description copied from interface: RootPaneContainer
getContentPane

Specified by:
getContentPane in interface RootPaneContainer

setContentPane

public void setContentPane(java.awt.Container contentPane)
Description copied from interface: RootPaneContainer
setContentPane

Specified by:
setContentPane in interface RootPaneContainer

getGlassPane

public java.awt.Component getGlassPane()
Description copied from interface: RootPaneContainer
getGlassPane

Specified by:
getGlassPane in interface RootPaneContainer

setGlassPane

public void setGlassPane(java.awt.Component glassPane)
Description copied from interface: RootPaneContainer
setGlassPane

Specified by:
setGlassPane in interface RootPaneContainer

addImpl

protected void addImpl(java.awt.Component comp,
                       java.lang.Object constraints,
                       int index)
Description copied from class: java.awt.Container
This method is called by all the add() 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.


remove

public void remove(java.awt.Component comp)
Description copied from class: java.awt.Container
Removes the specified component from this container.


isRootPaneCheckingEnabled

protected boolean isRootPaneCheckingEnabled()

setRootPaneCheckingEnabled

protected void setRootPaneCheckingEnabled(boolean enabled)

update

public void update(java.awt.Graphics g)
Description copied from class: java.awt.Container
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.


processKeyEvent

protected void processKeyEvent(java.awt.event.KeyEvent e)
Description copied from class: java.awt.Component
Called when a key event is dispatched and component events are enabled. This method passes the event along to any listeners that are attached.


setDefaultLookAndFeelDecorated

public static void setDefaultLookAndFeelDecorated(boolean decorated)

isDefaultLookAndFeelDecorated

public static boolean isDefaultLookAndFeelDecorated()

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Description copied from interface: javax.accessibility.Accessible
If a component supports the Accessibility API then this method should not return null. Only classes which must extend an accessible class, but must not itself be accessible, may return null.

Specified by:
getAccessibleContext in interface javax.accessibility.Accessible

getDefaultCloseOperation

public int getDefaultCloseOperation()

paramString

protected java.lang.String paramString()
Description copied from class: java.awt.Frame
Returns a debugging string describing this window.


processWindowEvent

protected void processWindowEvent(java.awt.event.WindowEvent e)
Description copied from class: java.awt.Window
Dispatches this event to any listeners that are listening for WindowEvents on this window. This method only gets invoked if it is enabled via enableEvents() or if a listener has been added.


setDefaultCloseOperation

public void setDefaultCloseOperation(int operation)
Defines what happens when this frame is closed. Can be one off EXIT_ON_CLOSE, DISPOSE_ON_CLOSE, HIDE_ON_CLOSE or DO_NOTHING_ON_CLOSE. The default is HIDE_ON_CLOSE. When EXIT_ON_CLOSE is specified this method calls SecurityManager.checkExit(0) which might throw a SecurityException. When the specified operation is not one of the above a IllegalArgumentException is thrown.