Java プラットフォーム 1.2

javax.swing
クラス CellRendererPane

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.CellRendererPane

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 のペイントは isShowing が false ではコンポーネントに対して何もしないからです。

警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の運用や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。今後の Swing リリースでは、長期間の持続性をサポートする予定です。

関連項目:
直列化された形式

内部クラスの概要
protected  class CellRendererPane.AccessibleCellRendererPane
           
 
フィールドの概要
protected  AccessibleContext accessibleContext
           
 
クラス java.awt.Component から継承したフィールド
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
コンストラクタの概要
CellRendererPane()
          CellRendererPane オブジェクトを構築します。
 
メソッドの概要
protected  void addImpl(Component x, Object constraints, int index)
          指定したコンポーネントがすでにこれの子の場合、あえて何かをすることはありません。
 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 をグラフィックスオブジェクト g にペイントします。
 void paintComponent(Graphics g, Component c, Container p, Rectangle r)
          矩形の x、y、幅、高さの各フィールドを使って this.paintComponent() を呼び出します。
 void update(Graphics g)
          呼び出してはなりません。
 
クラス java.awt.Container から継承したメソッド
add, add, add, add, add, addContainerListener, addNotify, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, validate, validateTree
 
クラス java.awt.Component から継承したメソッド
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, 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, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
クラス 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()
セルレンダリングの子が設定されるときに、無効なツリーが送られるのを避けるためにオーバーライドされます。
オーバーライド:
クラス Container 内の invalidate

paint

public void paint(Graphics g)
呼び出してはなりません。
オーバーライド:
クラス Container 内の paint

update

public void update(Graphics g)
呼び出してはなりません。
オーバーライド:
クラス Container 内の update

addImpl

protected void addImpl(Component x,
                       Object constraints,
                       int index)
指定したコンポーネントがすでにこれの子の場合、あえて何かをすることはありません。重なり順はセルレンダリングコンポーネントにとって問題になりません (CellRendererPane はいずれにしてもペイントしない)。
オーバーライド:
クラス Container 内の addImpl

paintComponent

public void paintComponent(Graphics g,
                           Component c,
                           Container p,
                           int x,
                           int y,
                           int w,
                           int h,
                           boolean shouldValidate)
セルレンダリングコンポーネント c をグラフィックスオブジェクト g にペイントします。コンポーネントが描画される前に、(必要に応じて) これに親が設定され、その境界は w と h に設定され、グラフィックスオブジェクトは (有効に) x、y に変換されます。これが JComponent の場合、ダブルバッファリングは一時的にオフに設定されます。コンポーネントのペイント後には、その境界は -w、-h、0、0 にリセットされるので、それがペイントされた最後のレンダリングコンポーネントの場合には、入力の消費を開始しません。コンテナ 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、幅、高さの各フィールドを使って this.paintComponent() を呼び出します。

getAccessibleContext

public AccessibleContext getAccessibleContext()
CellRendererPane に関連付けられている AccessibleContext を取得します。
定義:
インタフェース Accessible 内の getAccessibleContext
戻り値:
CellRendererPane の AccessibleContext

Java プラットフォーム 1.2

バグや機能要求の報告
新しい javadoc の表示についてのコメントやご提案
Java は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.