Example usage for Java javax.swing JPanel fields, constructors, methods, implement or subclass
The text is from its open source code.
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. |
Component | add(Component comp) Appends the specified component to the end of this container. |
Component | add(String name, Component comp) Adds the specified component to this container. |
void | addAncestorListener(AncestorListener listener) Registers listener so that it will receive AncestorEvents when it or any of its ancestors move or are made visible or invisible. |
void | addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component. |
void | addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container. |
void | addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component. |
void | addMouseListener(MouseListener l) Adds the specified mouse listener to receive mouse events from this component. |
void | addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component. |
void | applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it. |
JToolTip | createToolTip() Returns the instance of JToolTip that should be used to display the tooltip. |
void | doLayout() Causes this container to lay out its components. |
AccessibleContext | getAccessibleContext() Gets the AccessibleContext associated with this JPanel. |
ActionMap | getActionMap() Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding. |
Color | getBackground() Gets the background color of this component. |
Border | getBorder() Returns the border of this component or null if no border is currently set. |
Rectangle | getBounds() Gets the bounds of this component in the form of a Rectangle object. |
Component | getComponent(int n) Gets the nth component in this container. |
int | getComponentCount() Gets the number of components in this panel. |
Component[] | getComponents() Gets all the components in this container. |
DropTarget | getDropTarget() Gets the DropTarget associated with this Component . |
Set | getFocusTraversalKeys(int id) Returns the Set of focus traversal keys for a given traversal operation for this Container. |
Font | getFont() Gets the font of this component. |
FontMetrics | getFontMetrics(Font font) Gets the FontMetrics for the specified Font . |
Color | getForeground() Gets the foreground color of this component. |
Graphics | getGraphics() Returns this component's graphics context, which lets you draw on a component. |
int | getHeight() Returns the current height of this component. |
InputMap | getInputMap(int condition) Returns the InputMap that is used during condition . |
InputMap | getInputMap() Returns the InputMap that is used when the component has focus. |
Insets | getInsets() If a border has been set on this component, returns the border's insets; otherwise calls super.getInsets . |
LayoutManager | getLayout() Gets the layout manager for this container. |
Dimension | getMinimumSize() If the minimum size has been set to a non- null value just returns it. |
String | getName() Gets the name of the component. |
Container | getParent() Gets the parent of this component. |
Dimension | getPreferredSize() If the preferredSize has been set to a non-null value just returns it. |
Dimension | getSize() Returns the size of this component in the form of a Dimension object. |
Container | getTopLevelAncestor() 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. |
Rectangle | getVisibleRect() 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. |
int | getWidth() Returns the current width of this component. |
void | invalidate() Invalidates the container. |
boolean | isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container. |
boolean | isVisible() Determines whether this component should be visible when its parent is visible. |
void | paint(Graphics g) Invoked by Swing to draw components. |
boolean | prepareImage(Image image, ImageObserver observer) Prepares an image for rendering on this component. |
void | print(Graphics g) Invoke this method to print the component to the specified Graphics . |
void | putClientProperty(Object key, Object value) Adds an arbitrary key/value "client property" to this component. |
void | registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition) This method is now obsolete, please use a combination of getActionMap() and getInputMap() for similar behavior. |
void | remove(int index) Removes the component, specified by index , from this container. |
void | removeAll() Removes all the components from this container. |
void | removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component. |
void | repaint() Repaints this component. |
void | requestFocus() Requests that this Component gets the input focus. |
boolean | requestFocusInWindow() Requests that this Component gets the input focus. |
void | revalidate() Supports deferred automatic layout. |
void | scrollRectToVisible(Rectangle aRect) Forwards the scrollRectToVisible() message to the JComponent 's parent. |
void | setAlignmentX(float alignmentX) Sets the horizontal alignment. |
void | setAlignmentY(float alignmentY) Sets the vertical alignment. |
void | setAutoscrolls(boolean autoscrolls) Sets the autoscrolls property. |
void | setBackground(Color bg) Sets the background color of this component. |
void | setBorder(Border border) Sets the border of this component. |
void | setBounds(int x, int y, int width, int height) Moves and resizes this component. |
void | setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r . |
void | setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component. |
void | setComponentPopupMenu(JPopupMenu popup) Sets the JPopupMenu for this JComponent . |
void | setComponentZOrder(Component comp, int index) Moves the specified component to the specified z-order index in the container. |
void | setCursor(Cursor cursor) Sets the cursor image to the specified cursor. |
void | setDoubleBuffered(boolean aFlag) Sets whether this component should use a buffer to paint. |
void | setEnabled(boolean enabled) Sets whether or not this component is enabled. |
void | setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value. |
void | setFocusCycleRoot(boolean focusCycleRoot) Sets whether this Container is the root of a focus traversal cycle. |
void | setFocusTraversalKeys(int id, Set extends AWTKeyStroke> keystrokes) Sets the focus traversal keys for a given traversal operation for this Component. |
void | setFocusTraversalPolicy(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. |
void | setFocusTraversalPolicyProvider(boolean provider) Sets whether this container will be used to provide focus traversal policy. |
void | setFont(Font font) Sets the font for this component. |
void | setForeground(Color fg) Sets the foreground color of this component. |
void | setLayout(LayoutManager mgr) Sets the layout manager for this container. |
void | setLocation(int x, int y) Moves this component to a new location. |
void | setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value. |
void | setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value. |
void | setName(String name) Sets the name of the component to the specified string. |
void | setOpaque(boolean isOpaque) If true the component paints every pixel within its bounds. |
void | setPreferredSize(Dimension preferredSize) Sets the preferred size of this component. |
void | setSize(int width, int height) Resizes this component so that it has width width and height height . |
void | setSize(Dimension d) Resizes this component so that it has width d.width and height d.height . |
void | setToolTipText(String text) Registers the text to display in a tool tip. |
void | setTransferHandler(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. |
void | setVisible(boolean aFlag) Makes the component visible or invisible. |
void | updateUI() Resets the UI property with a value from the current look and feel. |
void | validate() Validates this container and all of its subcomponents. |