java.applet

java.awt

java.awt.color

java.awt.datatransfer

java.awt.dnd

java.awt.event

java.awt.font

java.awt.geom

java.awt.im

java.awt.im.spi

java.awt.image

java.awt.image.renderable

java.awt.print

java.beans

java.beans.beancontext

java.io

java.lang

java.lang.annotation

java.lang.instrument

java.lang.management

java.lang.ref

java.lang.reflect

java.math

java.net

java.nio

java.nio.channels

java.nio.channels.spi

java.nio.charset

java.nio.charset.spi

java.rmi

java.rmi.activation

java.rmi.dgc

java.rmi.registry

java.rmi.server

java.security

java.security.acl

java.security.cert

java.security.interfaces

java.security.spec

java.sql

java.text

java.util

java.util.concurrent

java.util.concurrent.atomic

java.util.concurrent.locks

java.util.jar

java.util.logging

java.util.prefs

java.util.regex

java.util.zip

javax.accessibility

javax.activity

javax.crypto

javax.crypto.interfaces

javax.crypto.spec

javax.imageio

javax.imageio.event

javax.imageio.metadata

javax.imageio.plugins.bmp

javax.imageio.plugins.jpeg

javax.imageio.spi

javax.imageio.stream

javax.management

javax.management.loading

javax.management.modelmbean

javax.management.monitor

javax.management.openmbean

javax.management.relation

javax.management.remote

javax.management.remote.rmi

javax.management.timer

javax.naming

javax.naming.directory

javax.naming.event

javax.naming.ldap

javax.naming.spi

javax.net

javax.net.ssl

javax.print

javax.print.attribute

javax.print.attribute.standard

javax.print.event

javax.rmi

javax.rmi.CORBA

javax.rmi.ssl

javax.security.auth

javax.security.auth.callback

javax.security.auth.kerberos

javax.security.auth.login

javax.security.auth.spi

javax.security.auth.x500

javax.security.cert

javax.security.sasl

javax.sound.midi

javax.sound.midi.spi

javax.sound.sampled

javax.sound.sampled.spi

javax.sql

javax.sql.rowset

javax.sql.rowset.serial

javax.sql.rowset.spi

javax.swing

javax.swing.border

javax.swing.colorchooser

javax.swing.event

javax.swing.filechooser

javax.swing.plaf

javax.swing.plaf.basic

javax.swing.plaf.metal

javax.swing.plaf.multi

javax.swing.plaf.synth

javax.swing.table

javax.swing.text

javax.swing.text

javax.swing.text.parser

javax.swing.text.rtf

javax.swing.tree

javax.swing.undo

javax.transaction

javax.transaction.xa

javax.xml

javax.xml.datatype

javax.xml.namespace

javax.xml.parsers

javax.xml.transform

javax.xml.transform.dom

javax.xml.transform.sax

javax.xml.transform.stream

javax.xml.validation

javax.xml.xpath

org.ietf.jgss

org.omg.CORBA

org.omg.CORBA_2_3

org.omg.CORBA_2_3.portable

org.omg.CORBA.DynAnyPackage

org.omg.CORBA.ORBPackage

org.omg.CORBA.portable

org.omg.CORBA.TypeCodePackage

org.omg.CosNaming

org.omg.CosNaming.NamingContextExtPackage

org.omg.CosNaming.NamingContextPackage

org.omg.Dynamic

org.omg.DynamicAny

org.omg.DynamicAny.DynAnyFactoryPackage

org.omg.DynamicAny.DynAnyPackage

org.omg.IOP

org.omg.IOP.CodecFactoryPackage

org.omg.IOP.CodecPackage

org.omg.Messaging

org.omg.PortableInterceptor

org.omg.PortableInterceptor.ORBInitInfoPackage

org.omg.PortableServer

org.omg.PortableServer.CurrentPackage

org.omg.PortableServer.POAManagerPackage

org.omg.PortableServer.POAPackage

org.omg.PortableServer.portable

org.omg.PortableServer.ServantLocatorPackage

org.omg.SendingContext

org.omg.stub.java.rmi

org.w3c.dom

org.w3c.dom.bootstrap

org.w3c.dom.events

org.w3c.dom.ls

org.xml.sax

org.xml.sax.ext

org.xml.sax.helpers

allclasses-frame

allclasses-noframe

constant-values

deprecated-list

help-doc

JavaTM 2 Platform
Standard Ed. 5.0

javax.swing
类 CellRendererPane

java.lang.Object
  继承者 java.awt.Component
      继承者 java.awt.Container
          继承者 javax.swing.CellRendererPane
所有已实现的接口:
ImageObserver, MenuContainer, Serializable, Accessible

public class CellRendererPane
extends Container
implements Accessible

此类被插入在单元格渲染器与使用它们的组件之间。它只是为了阻碍 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.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, 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
 

字段详细信息

accessibleContext

protected AccessibleContext accessibleContext
构造方法详细信息

CellRendererPane

public CellRendererPane()
构造一个 CellRendererPane 对象。

方法详细信息

invalidate

public void invalidate()
重写此方法是为了避免配置单元格渲染器的子级时顺着树向上传播 invalidate。

覆盖:
Container 中的 invalidate
另请参见:
Container.validate(), Container.layout(), LayoutManager

paint

public void paint(Graphics g)
不应调用。

覆盖:
Container 中的 paint
参数:
g - 指定的 Graphics 窗口
另请参见:
Component.update(Graphics)

update

public void update(Graphics g)
不应调用。

覆盖:
Container 中的 update
参数:
g - 指定的 Graphics 窗口
另请参见:
Component.update(Graphics)

addImpl

protected void addImpl(Component x,
                       Object constraints,
                       int index)
如果指定组件已经是此组件的子组件,则不必再操心去做任何事,堆栈顺序对于单元格渲染器组件而言无关紧要(CellRendererPane 不管怎样都不进行绘制)。

覆盖:
Container 中的 addImpl
参数:
x - 要添加的组件
constraints - 表示此组件的布局限制的对象
另请参见:
Container.add(Component), Container.add(Component, int), Container.add(Component, java.lang.Object), LayoutManager, LayoutManager2

paintComponent

public void paintComponent(Graphics g,
                           Component c,
                           Container p,
                           int x,
                           int y,
                           int w,
                           int h,
                           boolean shouldValidate)
在图形对象 g 上绘制一个单元格渲染器组件 c。在绘制该组件之前,要对此方法进行 reparent 操作(如有必要),将其边界设置为 w,h 并且将图形对象(有效地)转换成 x,y。如果该对象是一个 JComponent,则暂时关闭双重缓冲。在绘制组件之后,将边界重新设置为 -w, -h, 0, 0。因此,如果该组件是最后一个被绘制的渲染器组件,那么它不会开始使用输入。Container p 是我们实际要绘制的组件,通常它等于 this.getParent()。如果 shouldValidate 为 true,则组件 c 将在绘制之前被验证。


paintComponent

public 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)。


paintComponent

public void paintComponent(Graphics g,
                           Component c,
                           Container p,
                           Rectangle r)
使用矩形的 x、y、width 和 height 字段的调用 this.paintComponent()。


getAccessibleContext

public AccessibleContext getAccessibleContext()
获取与此 CellRendererPane 相关的 AccessibleContext。对于 CellRendererPanes,AccessibleContext 采用 AccessibleCellRendererPane 的形式。如有必要,可创建一个新的 AccessibleCellRendererPane 实例。

指定者:
接口 Accessible 中的 getAccessibleContext
覆盖:
Component 中的 getAccessibleContext
返回:
一个 AccessibleCellRendererPane,它可用作此 CellRendererPane 的 AccessibleContext

JavaTM 2 Platform
Standard Ed. 5.0

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策