Java javax.swing JPanel fields, constructors, methods, implement or subclass

Example usage for Java javax.swing JPanel fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for javax.swing JPanel.

The text is from its open source code.

Subclass

javax.swing.JPanel has subclasses.
Click this link to see all its subclasses.

Constructor

JPanel()
Creates a new JPanel with a double buffer and a flow layout.
JPanel(LayoutManager layout)
Create a new buffered JPanel with the specified layout manager
JPanel(boolean isDoubleBuffered)
Creates a new JPanel with FlowLayout and the specified buffering strategy.
JPanel(LayoutManager layout, boolean isDoubleBuffered)
Creates a new JPanel with the specified layout manager and buffering strategy.

Method

Componentadd(Component comp)
Appends the specified component to the end of this container.
Componentadd(String name, Component comp)
Adds the specified component to this container.
voidaddAncestorListener(AncestorListener listener)
Registers listener so that it will receive AncestorEvents when it or any of its ancestors move or are made visible or invisible.
voidaddComponentListener(ComponentListener l)
Adds the specified component listener to receive component events from this component.
voidaddContainerListener(ContainerListener l)
Adds the specified container listener to receive container events from this container.
voidaddKeyListener(KeyListener l)
Adds the specified key listener to receive key events from this component.
voidaddMouseListener(MouseListener l)
Adds the specified mouse listener to receive mouse events from this component.
voidaddMouseMotionListener(MouseMotionListener l)
Adds the specified mouse motion listener to receive mouse motion events from this component.
voidapplyComponentOrientation(ComponentOrientation o)
Sets the ComponentOrientation property of this container and all components contained within it.
JToolTipcreateToolTip()
Returns the instance of JToolTip that should be used to display the tooltip.
voiddoLayout()
Causes this container to lay out its components.
AccessibleContextgetAccessibleContext()
Gets the AccessibleContext associated with this JPanel.
ActionMapgetActionMap()
Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding.
ColorgetBackground()
Gets the background color of this component.
BordergetBorder()
Returns the border of this component or null if no border is currently set.
RectanglegetBounds()
Gets the bounds of this component in the form of a Rectangle object.
ComponentgetComponent(int n)
Gets the nth component in this container.
intgetComponentCount()
Gets the number of components in this panel.
Component[]getComponents()
Gets all the components in this container.
DropTargetgetDropTarget()
Gets the DropTarget associated with this Component .
SetgetFocusTraversalKeys(int id)
Returns the Set of focus traversal keys for a given traversal operation for this Container.
FontgetFont()
Gets the font of this component.
FontMetricsgetFontMetrics(Font font)
Gets the FontMetrics for the specified Font.
ColorgetForeground()
Gets the foreground color of this component.
GraphicsgetGraphics()
Returns this component's graphics context, which lets you draw on a component.
intgetHeight()
Returns the current height of this component.
InputMapgetInputMap(int condition)
Returns the InputMap that is used during condition.
InputMapgetInputMap()
Returns the InputMap that is used when the component has focus.
InsetsgetInsets()
If a border has been set on this component, returns the border's insets; otherwise calls super.getInsets.
LayoutManagergetLayout()
Gets the layout manager for this container.
DimensiongetMinimumSize()
If the minimum size has been set to a non-null value just returns it.
StringgetName()
Gets the name of the component.
ContainergetParent()
Gets the parent of this component.
DimensiongetPreferredSize()
If the preferredSize has been set to a non-null value just returns it.
DimensiongetSize()
Returns the size of this component in the form of a Dimension object.
ContainergetTopLevelAncestor()
Returns the top-level ancestor of this component (either the containing Window or Applet), or null if this component has not been added to any container.
RectanglegetVisibleRect()
Returns the Component's "visible rectangle" - the intersection of this component's visible rectangle, new Rectangle(0, 0, getWidth(), getHeight()), and all of its ancestors' visible rectangles.
intgetWidth()
Returns the current width of this component.
voidinvalidate()
Invalidates the container.
booleanisAncestorOf(Component c)
Checks if the component is contained in the component hierarchy of this container.
booleanisVisible()
Determines whether this component should be visible when its parent is visible.
voidpaint(Graphics g)
Invoked by Swing to draw components.
booleanprepareImage(Image image, ImageObserver observer)
Prepares an image for rendering on this component.
voidprint(Graphics g)
Invoke this method to print the component to the specified Graphics.
voidputClientProperty(Object key, Object value)
Adds an arbitrary key/value "client property" to this component.
voidregisterKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition)
This method is now obsolete, please use a combination of getActionMap() and getInputMap() for similar behavior.
voidremove(int index)
Removes the component, specified by index , from this container.
voidremoveAll()
Removes all the components from this container.
voidremoveKeyListener(KeyListener l)
Removes the specified key listener so that it no longer receives key events from this component.
voidrepaint()
Repaints this component.
voidrequestFocus()
Requests that this Component gets the input focus.
booleanrequestFocusInWindow()
Requests that this Component gets the input focus.
voidrevalidate()
Supports deferred automatic layout.
voidscrollRectToVisible(Rectangle aRect)
Forwards the scrollRectToVisible() message to the JComponent's parent.
voidsetAlignmentX(float alignmentX)
Sets the horizontal alignment.
voidsetAlignmentY(float alignmentY)
Sets the vertical alignment.
voidsetAutoscrolls(boolean autoscrolls)
Sets the autoscrolls property.
voidsetBackground(Color bg)
Sets the background color of this component.
voidsetBorder(Border border)
Sets the border of this component.
voidsetBounds(int x, int y, int width, int height)
Moves and resizes this component.
voidsetBounds(Rectangle r)
Moves and resizes this component to conform to the new bounding rectangle r .
voidsetComponentOrientation(ComponentOrientation o)
Sets the language-sensitive orientation that is to be used to order the elements or text within this component.
voidsetComponentPopupMenu(JPopupMenu popup)
Sets the JPopupMenu for this JComponent.
voidsetComponentZOrder(Component comp, int index)
Moves the specified component to the specified z-order index in the container.
voidsetCursor(Cursor cursor)
Sets the cursor image to the specified cursor.
voidsetDoubleBuffered(boolean aFlag)
Sets whether this component should use a buffer to paint.
voidsetEnabled(boolean enabled)
Sets whether or not this component is enabled.
voidsetFocusable(boolean focusable)
Sets the focusable state of this Component to the specified value.
voidsetFocusCycleRoot(boolean focusCycleRoot)
Sets whether this Container is the root of a focus traversal cycle.
voidsetFocusTraversalKeys(int id, Set keystrokes)
Sets the focus traversal keys for a given traversal operation for this Component.
voidsetFocusTraversalPolicy(FocusTraversalPolicy policy)
Sets the focus traversal policy that will manage keyboard traversal of this Container's children, if this Container is a focus cycle root.
voidsetFocusTraversalPolicyProvider(boolean provider)
Sets whether this container will be used to provide focus traversal policy.
voidsetFont(Font font)
Sets the font for this component.
voidsetForeground(Color fg)
Sets the foreground color of this component.
voidsetLayout(LayoutManager mgr)
Sets the layout manager for this container.
voidsetLocation(int x, int y)
Moves this component to a new location.
voidsetMaximumSize(Dimension maximumSize)
Sets the maximum size of this component to a constant value.
voidsetMinimumSize(Dimension minimumSize)
Sets the minimum size of this component to a constant value.
voidsetName(String name)
Sets the name of the component to the specified string.
voidsetOpaque(boolean isOpaque)
If true the component paints every pixel within its bounds.
voidsetPreferredSize(Dimension preferredSize)
Sets the preferred size of this component.
voidsetSize(int width, int height)
Resizes this component so that it has width width and height height .
voidsetSize(Dimension d)
Resizes this component so that it has width d.width and height d.height .
voidsetToolTipText(String text)
Registers the text to display in a tool tip.
voidsetTransferHandler(TransferHandler newHandler)
Sets the TransferHandler , which provides support for transfer of data into and out of this component via cut/copy/paste and drag and drop.
voidsetVisible(boolean aFlag)
Makes the component visible or invisible.
voidupdateUI()
Resets the UI property with a value from the current look and feel.
voidvalidate()
Validates this container and all of its subcomponents.