JavaTM Platform
Standard Ed. 6

javax.swing.plaf.basic
クラス BasicScrollBarUI

java.lang.Object
  上位を拡張 javax.swing.plaf.ComponentUI
      上位を拡張 javax.swing.plaf.ScrollBarUI
          上位を拡張 javax.swing.plaf.basic.BasicScrollBarUI
すべての実装されたインタフェース:
LayoutManager, SwingConstants
直系の既知のサブクラス:
MetalScrollBarUI

public class BasicScrollBarUI
extends ScrollBarUI
implements LayoutManager, SwingConstants

基本 Look & Feel のための、ScrollBarUI の実装です。


入れ子のクラスの概要
protected  class BasicScrollBarUI.ArrowButtonListener
          カーソルキーのリスナーです。
protected  class BasicScrollBarUI.ModelListener
          モデルの変更を待機するリスナーです。
 class BasicScrollBarUI.PropertyChangeHandler
           
protected  class BasicScrollBarUI.ScrollListener
          ScrollPane で初期化されるスクロールイベントのためのリスナーです。
protected  class BasicScrollBarUI.TrackListener
          マウスドラッグを追跡します。
 
フィールドの概要
protected  BasicScrollBarUI.ArrowButtonListener buttonListener
           
protected  JButton decrButton
           
protected static int DECREASE_HIGHLIGHT
           
protected  JButton incrButton
           
protected static int INCREASE_HIGHLIGHT
           
protected  boolean isDragging
           
protected  Dimension maximumThumbSize
           
protected  Dimension minimumThumbSize
           
protected  BasicScrollBarUI.ModelListener modelListener
           
protected static int NO_HIGHLIGHT
           
protected  PropertyChangeListener propertyChangeListener
           
protected  JScrollBar scrollbar
           
protected  BasicScrollBarUI.ScrollListener scrollListener
           
protected  Timer scrollTimer
           
protected  Color thumbColor
           
protected  Color thumbDarkShadowColor
           
protected  Color thumbHighlightColor
           
protected  Color thumbLightShadowColor
           
protected  Rectangle thumbRect
           
protected  Color trackColor
           
protected  int trackHighlight
           
protected  Color trackHighlightColor
           
protected  BasicScrollBarUI.TrackListener trackListener
           
protected  Rectangle trackRect
           
 
インタフェース 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
 
コンストラクタの概要
BasicScrollBarUI()
           
 
メソッドの概要
 void addLayoutComponent(String name, Component child)
          レイアウトマネージャーがコンポーネントごとの文字列を使用する場合、レイアウトにコンポーネントの comp を追加し、name によって指定された文字列に関連付けます。
protected  void configureScrollBarColors()
           
protected  BasicScrollBarUI.ArrowButtonListener createArrowButtonListener()
           
protected  JButton createDecreaseButton(int orientation)
           
protected  JButton createIncreaseButton(int orientation)
           
protected  BasicScrollBarUI.ModelListener createModelListener()
           
protected  PropertyChangeListener createPropertyChangeListener()
           
protected  BasicScrollBarUI.ScrollListener createScrollListener()
           
protected  BasicScrollBarUI.TrackListener createTrackListener()
           
static ComponentUI createUI(JComponent c)
           
 Dimension getMaximumSize(JComponent c)
          Look & Feel に適した、指定されたコンポーネントの最大サイズを返します。
protected  Dimension getMaximumThumbSize()
          サムに許容される最大のサイズを返します。
protected  Dimension getMinimumThumbSize()
          サムに許容される最小のサイズを返します。
 Dimension getPreferredSize(JComponent c)
          垂直スクロールバーの適切な幅は、増分ボタンおよび減分ボタンの適切な幅 (null 以外) の最大値、およびサムの最小幅です。
 boolean getSupportsAbsolutePositioning()
          ユーザーがマウスジェスチャー (通常はマウスの中央ボタン) を使ってサムの位置を確実に設定できるかどうかを指定します。
protected  Rectangle getThumbBounds()
          サムの現在のサイズおよび位置を返します。
protected  Rectangle getTrackBounds()
          トラックの現在の境界を返します。
protected  void installComponents()
           
protected  void installDefaults()
           
protected  void installKeyboardActions()
           
protected  void installListeners()
           
 void installUI(JComponent c)
          Look & Feel に適した、指定されたコンポーネントを構成します。
 boolean isThumbRollover()
          マウスが現在サムの上にある場合に true を返します。
 void layoutContainer(Container scrollbarContainer)
          指定されたコンテナを配置します。
protected  void layoutHScrollbar(JScrollBar sb)
           
protected  void layoutVScrollbar(JScrollBar sb)
           
 Dimension minimumLayoutSize(Container scrollbarContainer)
          指定されたコンテナの最小サイズの寸法を計算します。
 void paint(Graphics g, JComponent c)
          Look &Feel に適した、指定されたコンポーネントをペイントします。
protected  void paintDecreaseHighlight(Graphics g)
           
protected  void paintIncreaseHighlight(Graphics g)
           
protected  void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
           
protected  void paintTrack(Graphics g, JComponent c, Rectangle trackBounds)
           
 Dimension preferredLayoutSize(Container scrollbarContainer)
          指定されたコンテナの推奨サイズの寸法を計算します。
 void removeLayoutComponent(Component child)
          指定されたコンポーネントをレイアウトから削除します。
protected  void scrollByBlock(int direction)
           
protected  void scrollByUnit(int direction)
           
protected  void setThumbBounds(int x, int y, int width, int height)
          サムの境界を設定し、古い thumbBounds と新しい thumbBounds を含む、再ペイントを強制します。
protected  void setThumbRollover(boolean active)
          マウスが現在サムの上にあるかどうかを設定します。
protected  void uninstallComponents()
           
protected  void uninstallDefaults()
           
protected  void uninstallKeyboardActions()
           
protected  void uninstallListeners()
           
 void uninstallUI(JComponent c)
          installUI 時に、指定されたコンポーネントで構成された内容を取り消します。
 
クラス javax.swing.plaf.ComponentUI から継承されたメソッド
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMinimumSize, update
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

minimumThumbSize

protected Dimension minimumThumbSize

maximumThumbSize

protected Dimension maximumThumbSize

thumbHighlightColor

protected Color thumbHighlightColor

thumbLightShadowColor

protected Color thumbLightShadowColor

thumbDarkShadowColor

protected Color thumbDarkShadowColor

thumbColor

protected Color thumbColor

trackColor

protected Color trackColor

trackHighlightColor

protected Color trackHighlightColor

scrollbar

protected JScrollBar scrollbar

incrButton

protected JButton incrButton

decrButton

protected JButton decrButton

isDragging

protected boolean isDragging

trackListener

protected BasicScrollBarUI.TrackListener trackListener

buttonListener

protected BasicScrollBarUI.ArrowButtonListener buttonListener

modelListener

protected BasicScrollBarUI.ModelListener modelListener

thumbRect

protected Rectangle thumbRect

trackRect

protected Rectangle trackRect

trackHighlight

protected int trackHighlight

NO_HIGHLIGHT

protected static final int NO_HIGHLIGHT
関連項目:
定数フィールド値

DECREASE_HIGHLIGHT

protected static final int DECREASE_HIGHLIGHT
関連項目:
定数フィールド値

INCREASE_HIGHLIGHT

protected static final int INCREASE_HIGHLIGHT
関連項目:
定数フィールド値

scrollListener

protected BasicScrollBarUI.ScrollListener scrollListener

propertyChangeListener

protected PropertyChangeListener propertyChangeListener

scrollTimer

protected Timer scrollTimer
コンストラクタの詳細

BasicScrollBarUI

public BasicScrollBarUI()
メソッドの詳細

createUI

public static ComponentUI createUI(JComponent c)

configureScrollBarColors

protected void configureScrollBarColors()

installUI

public void installUI(JComponent c)
クラス ComponentUI の記述:
Look & Feel に適した、指定されたコンポーネントを構成します。このメソッドは、ComponentUI インスタンスが、指定されたコンポーネントの UI 委譲としてインストールされているときに呼び出されます。このメソッドは、以下を含む Look & Feel 用のコンポーネントを完全に構成する必要があります。
  1. カラー、フォント、ボーダー、アイコン、不透明さなどすべてのデフォルトプロパティーの値をコンポーネントにインストールする。可能な場合は、クライアントプログラムによって初期化されたプロパティーの値をオーバーライドしてはならない
  2. 必要に応じて、コンポーネントに LayoutManager をインストールする
  3. 必要なサブコンポーネントを、コンポーネントに作成または追加する
  4. イベントリスナーを、コンポーネントに作成またはインストールする
  5. コンポーネントのプロパティーの変更を適切に検出し、応答するために、PropertyChangeListener をコンポーネントに作成またはインストールする
  6. キーボード UI (ニーモニック、トラバーサルなど) を、コンポーネントにインストールする
  7. 適切なインスタンスのデータを初期化する

オーバーライド:
クラス ComponentUI 内の installUI
パラメータ:
c - UI 委譲がインストールされているコンポーネント
関連項目:
ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

uninstallUI

public void uninstallUI(JComponent c)
クラス ComponentUI の記述:
installUI 時に、指定されたコンポーネントで構成された内容を取り消します。このメソッドは、指定されたコンポーネントの UI 委譲としての UIComponent インスタンスが削除されているときに呼び出されます。このメソッドは、installUI によって実行された構成を元に戻す必要があります。この場合、JComponent インスタンスをクリーンな状態 (余分なリスナーや、Look & Feel 固有のプロパティーオブジェクトが残らないように) にするよう十分注意してください。手順には次のものがあります。
  1. UI として設定されたすべてのボーダーを、コンポーネントから削除する
  2. UI として設定されたすべてのレイアウトマネージャーを、コンポーネントから削除する
  3. UI として追加されたすべてのサブコンポーネントを、コンポーネントから削除する
  4. UI として追加されたすべてのイベント/リスナーを、コンポーネントから削除する
  5. UI としてインストールされたすべてのキーボード UI を、コンポーネントから削除する
  6. GC 用に割り当てられたすべてのインスタンスのデータオブジェクトを無効にする

オーバーライド:
クラス ComponentUI 内の uninstallUI
パラメータ:
c - この UI 委譲を削除するコンポーネント。 この引数は通常無視されるが、 UI オブジェクトに状態がなく、複数のコンポーネントに共有されている場合は 使用されることがある
関連項目:
ComponentUI.installUI(javax.swing.JComponent), JComponent.updateUI()

installDefaults

protected void installDefaults()

installComponents

protected void installComponents()

uninstallComponents

protected void uninstallComponents()

installListeners

protected void installListeners()

installKeyboardActions

protected void installKeyboardActions()

uninstallKeyboardActions

protected void uninstallKeyboardActions()

uninstallListeners

protected void uninstallListeners()

uninstallDefaults

protected void uninstallDefaults()

createTrackListener

protected BasicScrollBarUI.TrackListener createTrackListener()

createArrowButtonListener

protected BasicScrollBarUI.ArrowButtonListener createArrowButtonListener()

createModelListener

protected BasicScrollBarUI.ModelListener createModelListener()

createScrollListener

protected BasicScrollBarUI.ScrollListener createScrollListener()

createPropertyChangeListener

protected PropertyChangeListener createPropertyChangeListener()

setThumbRollover

protected void setThumbRollover(boolean active)
マウスが現在サムの上にあるかどうかを設定します。

パラメータ:
active - サムが現在アクティブになっている場合は true
導入されたバージョン:
1.5

isThumbRollover

public boolean isThumbRollover()
マウスが現在サムの上にある場合に true を返します。

戻り値:
サムが現在アクティブになっている場合は true
導入されたバージョン:
1.5

paint

public void paint(Graphics g,
                  JComponent c)
クラス ComponentUI の記述:
Look &Feel に適した、指定されたコンポーネントをペイントします。このメソッドは ComponentUI.update メソッドから、指定されたコンポーネントがペイントされるときに呼び出されます。サブクラスは、このメソッドをオーバーライドして、指定された Graphics オブジェクトを使ってコンポーネントの内容を描画する必要があります。

オーバーライド:
クラス ComponentUI 内の paint
パラメータ:
g - ペイント対象の Graphics コンテキスト
c - ペイントされるコンポーネント。 この引数は通常無視されるが、 UI オブジェクトに状態がなく、複数のコンポーネントに共有されている場合は 使用されることがある
関連項目:
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)

getPreferredSize

public Dimension getPreferredSize(JComponent c)
垂直スクロールバーの適切な幅は、増分ボタンおよび減分ボタンの適切な幅 (null 以外) の最大値、およびサムの最小幅です。適切な高さは、これらのコンポーネントの適切な高さの総計です。水平スクロールバーの適切なサイズも、これらのコンポーネントに基づいて決まります。

preferredSize は 1 回だけ計算されます。以後、このメソッドを呼び出すと、キャッシュに格納されたサイズ値が返されます。

オーバーライド:
クラス ComponentUI 内の getPreferredSize
パラメータ:
c - このメソッドを委譲している JScrollBar
戻り値:
Basic JScrollBar の適切なサイズ
関連項目:
getMaximumSize(javax.swing.JComponent), ComponentUI.getMinimumSize(javax.swing.JComponent)

getMaximumSize

public Dimension getMaximumSize(JComponent c)
クラス ComponentUI の記述:
Look & Feel に適した、指定されたコンポーネントの最大サイズを返します。null が返される場合、最大サイズは代わりにコンポーネントのレイアウトマネージャーによって計算されます (これは、特定のレイアウトマネージャーをインストールしてあるコンポーネントの場合に推奨する方法です)。このメソッドのデフォルト実装は getPreferredSize を呼び出して、その値を返します。

オーバーライド:
クラス ComponentUI 内の getMaximumSize
パラメータ:
c - このメソッドを委譲している JScrollBar
戻り値:
new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
関連項目:
ComponentUI.getMinimumSize(javax.swing.JComponent), getPreferredSize(javax.swing.JComponent)

createDecreaseButton

protected JButton createDecreaseButton(int orientation)

createIncreaseButton

protected JButton createIncreaseButton(int orientation)

paintDecreaseHighlight

protected void paintDecreaseHighlight(Graphics g)

paintIncreaseHighlight

protected void paintIncreaseHighlight(Graphics g)

paintTrack

protected void paintTrack(Graphics g,
                          JComponent c,
                          Rectangle trackBounds)

paintThumb

protected void paintThumb(Graphics g,
                          JComponent c,
                          Rectangle thumbBounds)

getMinimumThumbSize

protected Dimension getMinimumThumbSize()
サムに許容される最小のサイズを返します。スクロールバーが小さすぎてこのサイズでは利用できない場合、サムは隠されます。

警告:このメソッドが返す値は変更しないでください。これは共有される静的定数です。

戻り値:
サムに許容できる最小のサイズ
関連項目:
getMaximumThumbSize()

getMaximumThumbSize

protected Dimension getMaximumThumbSize()
サムに許容される最大のサイズを返します。固定サイズのサムを作成するには、このメソッドを作成すると getMinimumThumbSize が同じ値を返します。

警告:このメソッドが返す値は変更しないでください。これは共有される静的定数です。

戻り値:
サムに許容できる最大のサイズ
関連項目:
getMinimumThumbSize()

addLayoutComponent

public void addLayoutComponent(String name,
                               Component child)
インタフェース LayoutManager の記述:
レイアウトマネージャーがコンポーネントごとの文字列を使用する場合、レイアウトにコンポーネントの comp を追加し、name によって指定された文字列に関連付けます。

定義:
インタフェース LayoutManager 内の addLayoutComponent
パラメータ:
name - コンポーネントに関連付けられた文字列
child - 追加されるコンポーネント

removeLayoutComponent

public void removeLayoutComponent(Component child)
インタフェース LayoutManager の記述:
指定されたコンポーネントをレイアウトから削除します。

定義:
インタフェース LayoutManager 内の removeLayoutComponent
パラメータ:
child - 削除されるコンポーネント

preferredLayoutSize

public Dimension preferredLayoutSize(Container scrollbarContainer)
インタフェース LayoutManager の記述:
指定されたコンテナの推奨サイズの寸法を計算します。含まれるコンポーネントは指定されます。

定義:
インタフェース LayoutManager 内の preferredLayoutSize
パラメータ:
scrollbarContainer - 配置されるコンテナ
関連項目:
LayoutManager.minimumLayoutSize(java.awt.Container)

minimumLayoutSize

public Dimension minimumLayoutSize(Container scrollbarContainer)
インタフェース LayoutManager の記述:
指定されたコンテナの最小サイズの寸法を計算します。含まれるコンポーネントは指定されます。

定義:
インタフェース LayoutManager 内の minimumLayoutSize
パラメータ:
scrollbarContainer - 配置されるコンポーネント
関連項目:
LayoutManager.preferredLayoutSize(java.awt.Container)

layoutVScrollbar

protected void layoutVScrollbar(JScrollBar sb)

layoutHScrollbar

protected void layoutHScrollbar(JScrollBar sb)

layoutContainer

public void layoutContainer(Container scrollbarContainer)
インタフェース LayoutManager の記述:
指定されたコンテナを配置します。

定義:
インタフェース LayoutManager 内の layoutContainer
パラメータ:
scrollbarContainer - 配置されるコンテナ

setThumbBounds

protected void setThumbBounds(int x,
                              int y,
                              int width,
                              int height)
サムの境界を設定し、古い thumbBounds と新しい thumbBounds を含む、再ペイントを強制します。

関連項目:
getThumbBounds()

getThumbBounds

protected Rectangle getThumbBounds()
サムの現在のサイズおよび位置を返します。

警告:このメソッドが返す値は変更しないでください。これは実際の矩形への参照です。コピーではありません。

戻り値:
サムの現在のサイズまたは位置
関連項目:
setThumbBounds(int, int, int, int)

getTrackBounds

protected Rectangle getTrackBounds()
トラックの現在の境界を返します。 すなわち、増分ボタンと減分ボタンの間のスペースからインセットを除いた分です。このメソッドが返す値は、スクロールバーが配置される (検証される) たびに更新されます。

警告:このメソッドが返す値は変更しないでください。これは実際の矩形への参照です。 コピーではありません。

戻り値:
スクロールバーのトラックの現在の境界
関連項目:
layoutContainer(java.awt.Container)

scrollByBlock

protected void scrollByBlock(int direction)

scrollByUnit

protected void scrollByUnit(int direction)

getSupportsAbsolutePositioning

public boolean getSupportsAbsolutePositioning()
ユーザーがマウスジェスチャー (通常はマウスの中央ボタン) を使ってサムの位置を確実に設定できるかどうかを指定します。

戻り値:
マウスジェスチャーでサムの位置を確実に設定できる場合は true
導入されたバージョン:
1.5

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 も参照してください。