©
本文档使用
php.cn手册 发布
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Object java.awt.Component java.awt.Container javax.swing.CellRendererPane
public class CellRendererPane
此类被插入在单元格渲染器与使用它们的组件之间。它只是为了阻碍 repaint() 和 invalidate() 方法而存在,在配置渲染器时,这些方法将顺着树向上传播。此类用于 JTable、JTree 和 JList 的实现中。例如,以下是绘制 JList 中每个行的代码中使用 CellRendererPane 的方式:
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 paint 在 isShowing 返回 false 时不对组件做任何操作。
警告:此类的已序列化对象与以后的 Swing 版本不兼容。当前序列化支持适用于短期存储,或适用于在运行相同 Swing 版本的应用程序之间进行 RMI(Remote Method Invocation,远程方法调用)。从 1.4 版本开始,已在 java.beans
包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder
。
嵌套类摘要 | |
---|---|
protected class |
CellRendererPane.AccessibleCellRendererPane
此类实现 Panel 类的可访问性支持。 |
从类 java.awt.Container 继承的嵌套类/接口 |
---|
Container.AccessibleAWTContainer |
从类 java.awt.Component 继承的嵌套类/接口 |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
字段摘要 | |
---|---|
protected AccessibleContext |
accessibleContext
|
从类 java.awt.Component 继承的字段 |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
从接口 java.awt.image.ImageObserver 继承的字段 |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
构造方法摘要 | |
---|---|
CellRendererPane()
构造一个 CellRendererPane 对象。 |
方法摘要 | |
---|---|
protected void |
addImpl(Component x,
Object constraints,
int index)
如果指定组件已经是此组件的子组件,则不必再操心去做任何事,堆栈顺序对于单元格渲染器组件而言无关紧要(CellRendererPane 不管怎样都不进行绘制)。 |
AccessibleContext |
getAccessibleContext()
获取与此 CellRendererPane 相关的 AccessibleContext。 |
void |
invalidate()
重写此方法是为了避免配置单元格渲染器的子级时顺着树向上传播 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)
在图形对象 g 上绘制一个单元格渲染器组件 c。 |
void |
paintComponent(Graphics g,
Component c,
Container p,
Rectangle r)
使用矩形的 x、y、width 和 height 字段的调用 this.paintComponent()。 |
void |
update(Graphics g)
不应调用。 |
从类 java.awt.Container 继承的方法 |
---|
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, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
从类 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, 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, 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, transferFocusUpCycle |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
字段详细信息 |
---|
protected AccessibleContext accessibleContext
构造方法详细信息 |
---|
public CellRendererPane()
方法详细信息 |
---|
public void invalidate()
Container
中的 invalidate
Container.validate()
,
Container.layout()
,
LayoutManager
,
LayoutManager2.invalidateLayout(Container)
public void paint(Graphics g)
Container
中的 paint
g
- 指定的 Graphics 窗口Component.update(Graphics)
public void update(Graphics g)
Container
中的 update
g
- 指定的 Graphics 窗口Component.update(Graphics)
protected void addImpl(Component x, Object constraints, int index)
Container
中的 addImpl
x
- 要添加的组件constraints
- 表示此组件的布局约束的对象Container.add(Component)
,
Container.add(Component, int)
,
Container.add(Component, java.lang.Object)
,
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()
Accessible
中的 getAccessibleContext
Component
中的 getAccessibleContext
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。