JavaTM Platform
Standard Ed. 6

javax.swing
クラス DefaultListCellRenderer

java.lang.Object
  上位を拡張 java.awt.Component
      上位を拡張 java.awt.Container
          上位を拡張 javax.swing.JComponent
              上位を拡張 javax.swing.JLabel
                  上位を拡張 javax.swing.DefaultListCellRenderer
すべての実装されたインタフェース:
ImageObserver, MenuContainer, Serializable, Accessible, ListCellRenderer, SwingConstants
直系の既知のサブクラス:
DefaultListCellRenderer.UIResource, MetalFileChooserUI.FileRenderer, MetalFileChooserUI.FilterComboBoxRenderer

public class DefaultListCellRenderer
extends JLabel
implements ListCellRenderer, Serializable

リスト内の項目を描画します。

実装上の注意: このクラスは、パフォーマンス向上のため、invalidatevalidaterevalidaterepaintisOpaque、および firePropertyChange のみをオーバーライドします。オーバーライドされない場合、呼び出し頻度の高いメソッドが、デフォルトのリストセルレンダリングでは必要のないコードパスを実行します。独自のレンダリングロジックを作成する場合は、これらのメソッドのオーバーライドでの利点や欠点に注意してください。

警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の運用や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。JDK Version 1.4 以降、すべての JavaBeans の長期間の運用サポートは、java.beans パッケージに追加されています。詳細は、XMLEncoder を参照してください。


入れ子のクラスの概要
static class DefaultListCellRenderer.UIResource
          UIResource を実装する DefaultListCellRenderer のサブクラスです。
 
クラス javax.swing.JLabel から継承された入れ子のクラス/インタフェース
JLabel.AccessibleJLabel
 
クラス javax.swing.JComponent から継承された入れ子のクラス/インタフェース
JComponent.AccessibleJComponent
 
クラス java.awt.Container から継承された入れ子のクラス/インタフェース
Container.AccessibleAWTContainer
 
クラス java.awt.Component から継承された入れ子のクラス/インタフェース
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
フィールドの概要
protected static Border noFocusBorder
          空の Border です。
 
クラス javax.swing.JLabel から継承されたフィールド
labelFor
 
クラス javax.swing.JComponent から継承されたフィールド
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
クラス java.awt.Component から継承されたフィールド
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
インタフェース javax.swing.SwingConstants から継承されたフィールド
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
インタフェース java.awt.image.ImageObserver から継承されたフィールド
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
コンストラクタの概要
DefaultListCellRenderer()
          リスト内の項目に使用するデフォルトのレンダリングオブジェクトを構築します。
 
メソッドの概要
 void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
          パフォーマンス上の理由でオーバーライドされます。
 void firePropertyChange(String propertyName, byte oldValue, byte newValue)
          パフォーマンス上の理由でオーバーライドされます。
 void firePropertyChange(String propertyName, char oldValue, char newValue)
          パフォーマンス上の理由でオーバーライドされます。
 void firePropertyChange(String propertyName, double oldValue, double newValue)
          パフォーマンス上の理由でオーバーライドされます。
 void firePropertyChange(String propertyName, float oldValue, float newValue)
          パフォーマンス上の理由でオーバーライドされます。
 void firePropertyChange(String propertyName, int oldValue, int newValue)
          パフォーマンス上の理由でオーバーライドされます。
 void firePropertyChange(String propertyName, long oldValue, long newValue)
          パフォーマンス上の理由でオーバーライドされます。
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          パフォーマンス上の理由でオーバーライドされます。
 void firePropertyChange(String propertyName, short oldValue, short newValue)
          パフォーマンス上の理由でオーバーライドされます。
 Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
          指定された値を表示するように設定されたコンポーネントを返します。
 void invalidate()
          パフォーマンス上の理由でオーバーライドされます。
 boolean isOpaque()
          パフォーマンス上の理由でオーバーライドされます。
 void repaint()
          パフォーマンス上の理由でオーバーライドされます。
 void repaint(long tm, int x, int y, int width, int height)
          パフォーマンス上の理由でオーバーライドされます。
 void repaint(Rectangle r)
          パフォーマンス上の理由でオーバーライドされます。
 void revalidate()
          パフォーマンス上の理由でオーバーライドされます。
 void validate()
          パフォーマンス上の理由でオーバーライドされます。
 
クラス javax.swing.JLabel から継承されたメソッド
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI
 
クラス javax.swing.JComponent から継承されたメソッド
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
クラス java.awt.Container から継承されたメソッド
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validateTree
 
クラス java.awt.Component から継承されたメソッド
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

noFocusBorder

protected static Border noFocusBorder
空の Border です。このフィールドは使用できません。このレンダラで使用される Border を変更するには、getListCellRendererComponent メソッドをオーバーライドし、返されるコンポーネントのボーダーを直接設定します。

コンストラクタの詳細

DefaultListCellRenderer

public DefaultListCellRenderer()
リスト内の項目に使用するデフォルトのレンダリングオブジェクトを構築します。

メソッドの詳細

getListCellRendererComponent

public Component getListCellRendererComponent(JList list,
                                              Object value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus)
インタフェース ListCellRenderer の記述:
指定された値を表示するように設定されたコンポーネントを返します。次に、そのコンポーネントの paint メソッドが呼び出されて、セルを「描画」します。リストセルのサイズが固定されていないため、リストの寸法を計算する必要がある場合には、このメソッドが呼び出されて、getPreferredSize を呼び出せるコンポーネントを生成します。

定義:
インタフェース ListCellRenderer 内の getListCellRendererComponent
パラメータ:
list - ペイントしている JList
value - list.getModel().getElementAt(index) によって返される値
index - セルのインデックス
isSelected - 指定されたセルが選択された場合は true
cellHasFocus - 指定されたセルにフォーカスがある場合は true
戻り値:
指定された値を描画する paint() メソッドがあるコンポーネント
関連項目:
JList, ListSelectionModel, ListModel

isOpaque

public boolean isOpaque()
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス JComponent 内の isOpaque
戻り値:
バックグラウンドが完全に不透明で、 JList のバックグラウンドと異なる場合は true、 そうでない場合は false
導入されたバージョン:
1.5
関連項目:
JComponent.setOpaque(boolean)

validate

public void validate()
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス Container 内の validate
関連項目:
Container.add(java.awt.Component), Component.invalidate(), JComponent.revalidate(), Container.validateTree()

invalidate

public void invalidate()
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス Container 内の invalidate
導入されたバージョン:
1.5
関連項目:
Container.validate(), Container.layout(), LayoutManager, LayoutManager2.invalidateLayout(Container)

repaint

public void repaint()
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス Component 内の repaint
導入されたバージョン:
1.5
関連項目:
Component.update(Graphics)

revalidate

public void revalidate()
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス JComponent 内の revalidate
関連項目:
Component.invalidate(), Container.validate(), JComponent.isValidateRoot(), RepaintManager.addInvalidComponent(javax.swing.JComponent)

repaint

public void repaint(long tm,
                    int x,
                    int y,
                    int width,
                    int height)
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス JComponent 内の repaint
パラメータ:
tm - このパラメータは使用されません
x - ダーティリージョンの x 座標
y - ダーティリージョンの y 座標
width - ダーティリージョンの幅
height - ダーティリージョンの高さ
関連項目:
Component.isShowing(), RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)

repaint

public void repaint(Rectangle r)
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス JComponent 内の repaint
パラメータ:
r - ダーティリージョンを含む Rectangle
関連項目:
Component.isShowing(), RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  Object oldValue,
                                  Object newValue)
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス Component 内の firePropertyChange
パラメータ:
propertyName - 値が変更されたプロパティー
oldValue - プロパティーの以前の値
newValue - プロパティーの新しい値

firePropertyChange

public void firePropertyChange(String propertyName,
                               byte oldValue,
                               byte newValue)
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス Component 内の firePropertyChange
パラメータ:
propertyName - 変更されたプロパティーの プログラム上の名前
oldValue - プロパティーの変更前の値 (byte)
newValue - プロパティーの変更後の値 (byte)
関連項目:
#firePropertyChange(java.lang.String, java.lang.Object,

firePropertyChange

public void firePropertyChange(String propertyName,
                               char oldValue,
                               char newValue)
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス JComponent 内の firePropertyChange
パラメータ:
propertyName - 変更されたプロパティーの プログラム上の名前
oldValue - プロパティーの変更前の値 (char)
newValue - プロパティーの変更後の値 (char)
関連項目:
#firePropertyChange(java.lang.String, java.lang.Object,

firePropertyChange

public void firePropertyChange(String propertyName,
                               short oldValue,
                               short newValue)
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス Component 内の firePropertyChange
パラメータ:
propertyName - 変更されたプロパティーの プログラム上の名前
oldValue - プロパティーの変更後の値 (short)
newValue - プロパティーの変更後の値 (short)
関連項目:
#firePropertyChange(java.lang.String, java.lang.Object,

firePropertyChange

public void firePropertyChange(String propertyName,
                               int oldValue,
                               int newValue)
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス JComponent 内の firePropertyChange
パラメータ:
propertyName - 値が変更されたプロパティー
oldValue - プロパティーの以前の値
newValue - プロパティーの新しい値

firePropertyChange

public void firePropertyChange(String propertyName,
                               long oldValue,
                               long newValue)
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス Component 内の firePropertyChange
パラメータ:
propertyName - 変更されたプロパティーの プログラム上の名前
oldValue - プロパティーの変更前の値 (long)
newValue - プロパティーの変更後の値 (long)
関連項目:
#firePropertyChange(java.lang.String, java.lang.Object,

firePropertyChange

public void firePropertyChange(String propertyName,
                               float oldValue,
                               float newValue)
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス Component 内の firePropertyChange
パラメータ:
propertyName - 変更されたプロパティーの プログラム上の名前
oldValue - プロパティーの変更前の値 (float)
newValue - プロパティーの変更後の値 (float)
関連項目:
#firePropertyChange(java.lang.String, java.lang.Object,

firePropertyChange

public void firePropertyChange(String propertyName,
                               double oldValue,
                               double newValue)
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス Component 内の firePropertyChange
パラメータ:
propertyName - 変更されたプロパティーの プログラム上の名前
oldValue - プロパティーの変更前の値 (double)
newValue - プロパティーの変更後の値 (double)
関連項目:
#firePropertyChange(java.lang.String, java.lang.Object,

firePropertyChange

public void firePropertyChange(String propertyName,
                               boolean oldValue,
                               boolean newValue)
パフォーマンス上の理由でオーバーライドされます。詳細は「実装上の注意」を参照してください。

オーバーライド:
クラス JComponent 内の firePropertyChange
パラメータ:
propertyName - 値が変更されたプロパティー
oldValue - プロパティーの以前の値
newValue - プロパティーの新しい値

JavaTM Platform
Standard Ed. 6

バグの報告と機能のリクエスト
さらに詳しい API リファレンスおよび開発者ドキュメントについては、Java SE 開発者用ドキュメントを参照してください。開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、およびコード実例が含まれています。

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。