javax.swing
Class JPanel
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JPanel
- All Implemented Interfaces:
- Accessible, ImageObserver, MenuContainer, Serializable
- Direct Known Subclasses:
- AbstractColorChooserPanel
- public class JPanel
- extends JComponent
- implements Accessible
JPanel is a generic lightweight container.
For examples and task-oriented documentation for JPanel, see
How to Use Panels,
a section in The Java Tutorial.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is appropriate
for short term storage or RMI between applications running the same
version of Swing. A future release of Swing will provide support for
long term persistence.
- See Also:
- Serialized Form
Inner Class Summary |
protected class |
JPanel.AccessibleJPanel
This class implements accessibility support for the
JPanel class. |
Constructor Summary |
JPanel()
Create a new JPanel with a double buffer and a flow layout |
JPanel(boolean isDoubleBuffered)
Create a new JPanel with FlowLayout and the specified buffering
strategy. |
JPanel(LayoutManager layout)
Create a new buffered JPanel with the specified layout manager |
JPanel(LayoutManager layout,
boolean isDoubleBuffered)
Creates a new JPanel with the specified layout manager and buffering
strategy. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
JPanel
public JPanel(LayoutManager layout,
boolean isDoubleBuffered)
- Creates a new JPanel with the specified layout manager and buffering
strategy.
- Parameters:
layout
- the LayoutManager to useisDoubleBuffered
- a boolean, true for double-buffering, which
uses additional memory space to achieve fast, flicker-free
updates
JPanel
public JPanel(LayoutManager layout)
- Create a new buffered JPanel with the specified layout manager
- Parameters:
layout
- the LayoutManager to use
JPanel
public JPanel(boolean isDoubleBuffered)
- Create a new JPanel with FlowLayout and the specified buffering
strategy. If
isDoubleBuffered
is true, the JPanel
will use a double buffer.
- Parameters:
layout
- the LayoutManager to useisDoubleBuffered
- a boolean, true for double-buffering, which
uses additional memory space to achieve fast, flicker-free
updates
JPanel
public JPanel()
- Create a new JPanel with a double buffer and a flow layout
updateUI
public void updateUI()
- Notification from the UIFactory that the L&F
has changed.
- Overrides:
updateUI
in class JComponent
- See Also:
JComponent.updateUI()
getUIClassID
public String getUIClassID()
- Returns a string that specifies the name of the L&F class
that renders this component.
- Overrides:
getUIClassID
in class JComponent
- Returns:
- "PanelUI"
- See Also:
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
paramString
protected String paramString()
- Returns a string representation of this JPanel. This method
is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not
be
null
.
- Overrides:
paramString
in class JComponent
- Returns:
- a string representation of this JPanel.
getAccessibleContext
public AccessibleContext getAccessibleContext()
- Gets the AccessibleContext associated with this JPanel.
For JPanels, the AccessibleContext takes the form of an
AccessibleJPanel.
A new AccessibleJPanel instance is created if necessary.
- Specified by:
getAccessibleContext
in interface Accessible
- Overrides:
getAccessibleContext
in class JComponent
- Returns:
- an AccessibleJPanel that serves as the
AccessibleContext of this JPanel
Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Java, Java 2D, and JDBC are trademarks or registered trademarks of Oracle and/or its affiliates, in the US and other countries.
Copyright © 1995, 2010 Oracle and/or its affiliates. All rights reserved.