public class CellRendererPane extends Container implements Accessible
cellRendererPane = new CellRendererPane();
...
Component rendererComponent = renderer.getListCellRendererComponent();
renderer.configureListCellRenderer(dataModel.getElementAt(row), row);
cellRendererPane.paintComponent(g, rendererComponent, this, x, y, w, h);
渲染器组件必须重写isShowing(),并无条件地返回true以正常工作,因为Swing绘图对于具有isShowing false的组件不起作用。
警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,对于所有JavaBeans的长期存储的支持已被添加到java.beans
包中。 请参阅XMLEncoder
。
Modifier and Type | Class and Description |
---|---|
protected class |
CellRendererPane.AccessibleCellRendererPane
这个类实现了可访问性支持
CellRendererPane 类。
|
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected AccessibleContext |
accessibleContext |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
CellRendererPane()
构造一个CellRendererPane对象。
|
Modifier and Type | Method and Description |
---|---|
protected void |
addImpl(Component x, Object constraints, int index)
如果指定的组件已经是一个小孩,那么我们不用担心任何事情 - 堆栈顺序对于单元格渲染器组件并不重要(CellRendererPane不会绘制)。
|
AccessibleContext |
getAccessibleContext()
获取与此CellRendererPane关联的AccessibleContext。
|
void |
invalidate()
当配置单元格渲染器子时,覆盖以避免传播使树无效。
|
void |
paint(Graphics g)
不应该叫
|
void |
paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h)
调用this.paintComponent(g,c,p,x,y,w,h,false)。
|
void |
paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h, boolean shouldValidate)
在图形对象上绘制单元格渲染器组件c。
|
void |
paintComponent(Graphics g, Component c, Container p, Rectangle r)
调用this.paintComponent()与矩形x,y,width,height字段。
|
void |
update(Graphics g)
不应该叫
|
add, add, add, add, add, addContainerListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, validate, validateTree
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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected AccessibleContext accessibleContext
public void invalidate()
invalidate
在类别
Container
Container.validate()
, Container.layout()
, LayoutManager2
public void paint(Graphics g)
paint
在类别
Container
g
- 指定的图形窗口
Component.update(Graphics)
public void update(Graphics g)
update
在类别
Container
g
- 指定的图形窗口
Component.update(Graphics)
protected void addImpl(Component x, Object constraints, int index)
addImpl
在
Container
x
- 要添加的组件
constraints
- 表示此组件的布局约束的对象
index
- 容器列表中插入组件的位置,其中
-1
表示附加到最后
Container.add(Component)
, Container.add(Component, int)
, Container.add(Component, java.lang.Object)
, Container.invalidate()
, LayoutManager
, LayoutManager2
public void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h, boolean shouldValidate)
public void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h)
public void paintComponent(Graphics g, Component c, Container p, Rectangle r)
public AccessibleContext getAccessibleContext()
getAccessibleContext
在界面
Accessible
getAccessibleContext
在类别
Component
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.