|
JavaTM Platform Standard Ed. 6 |
|||||||||
앞의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
개요 : 상자 | 필드 | 생성자 | 메소드 | 상세 : 필드 | 생성자 | 메소드 |
java.lang.Object javax.swing.plaf.ComponentUI javax.swing.plaf.ListUI javax.swing.plaf.basic.BasicListUI
public class BasicListUI
ListUI
의 확장 구현입니다.
복수의 리스트간에 BasicListUI
인스턴스를 공유할 수 없습니다.
상자의 클래스의 개요 | |
---|---|
class |
BasicListUI.FocusHandler
이 내부 클래스는 「public」라고 마크 됩니다만, 이것은 컴파일러의 버그가 원인입니다. |
class |
BasicListUI.ListDataHandler
installUI 의 실행시, 및 JList.model 프로퍼티의 변경시에, JList 모델에 추가되는 ListDataListener 입니다. |
class |
BasicListUI.ListSelectionHandler
installUI 의 실행시, 및 JList.selectionModel 프로퍼티의 변경시에, JLists 선택 모델에 추가되는 ListSelectionListener 입니다. |
class |
BasicListUI.MouseInputHandler
JList 를 위한 포커스 처리와 마우스 입력입니다. |
class |
BasicListUI.PropertyChangeHandler
PropertyChangeListener 는, installUI 의 실행시에 JList 에 추가됩니다. |
필드의 개요 | |
---|---|
protected int |
cellHeight
|
protected int[] |
cellHeights
|
protected static int |
cellRendererChanged
|
protected int |
cellWidth
|
protected static int |
fixedCellHeightChanged
|
protected static int |
fixedCellWidthChanged
|
protected FocusListener |
focusListener
|
protected static int |
fontChanged
|
protected JList |
list
|
protected ListDataListener |
listDataListener
|
protected ListSelectionListener |
listSelectionListener
|
protected static int |
modelChanged
|
protected MouseInputListener |
mouseInputListener
|
protected PropertyChangeListener |
propertyChangeListener
|
protected static int |
prototypeCellValueChanged
|
protected CellRendererPane |
rendererPane
|
protected static int |
selectionModelChanged
|
protected int |
updateLayoutStateNeeded
|
생성자 의 개요 | |
---|---|
BasicListUI ()
|
메소드의 개요 | |
---|---|
protected int |
convertRowToY (int row)
지정된 행의 원점의 JList 상대 Y 좌표를 돌려줍니다. |
protected int |
convertYToRow (int y0)
JList 의 상대 좌표를, 현재의 레이아웃을 기본으로 해, 좌표를 포함한 행으로 변환합니다. |
protected FocusListener |
createFocusListener ()
|
protected ListDataListener |
createListDataListener ()
모델에 의해 필요에 따라서 JList 에 추가되는, ListDataListener 의 인스턴스를 생성합니다. |
protected ListSelectionListener |
createListSelectionListener ()
selectionModel 에 의해 필요에 따라서 JList 에 추가되는, ListSelectionHandler 의 인스턴스를 생성합니다. |
protected MouseInputListener |
createMouseInputListener ()
MouseInputListener 를 구현하는 위양을 작성합니다. |
protected PropertyChangeListener |
createPropertyChangeListener ()
installUI()에 의해 JList 에 추가되는, PropertyChangeHandler 의 인스턴스를 생성합니다. |
static ComponentUI |
createUI (JComponent list)
BasicListUI 의 새로운 인스턴스를 돌려줍니다. |
int |
getBaseline (JComponent c,
int width,
int height)
baseline를 돌려줍니다. |
Component.BaselineResizeBehavior |
getBaselineResizeBehavior (JComponent c)
컴퍼넌트의 사이즈가 변화하는 것에 따라 baseline가 변화하는 방법의 열거를 돌려줍니다. |
Rectangle |
getCellBounds (JList list,
int index1,
int index2)
2 개의 인덱스로 지정된 셀의 범위를 나타내는, 지정된 리스트의 좌표계내의 경계의 구형을 돌려줍니다. |
Dimension |
getPreferredSize (JComponent c)
리스트의 preferredSize 는, 배치 방향에 의해 정해집니다. |
protected int |
getRowHeight (int row)
현재의 레이아웃으로, 지정된 행의 높이를 돌려줍니다. |
Point |
indexToLocation (JList list,
int index)
리스트의 좌표계내의 지정된 항목의 지정된 JList 내의 원점을 돌려줍니다. |
protected void |
installDefaults ()
JList 의 프로퍼티 (폰트, foreground, 및 백그라운드등)을 초기화해, CellRendererPane 를 추가합니다. |
protected void |
installKeyboardActions ()
BasicListUI 를 관련지을 수 있는 JList 상의 키보드 바인딩을 돌려줍니다. |
protected void |
installListeners ()
JList, 그 모델, 및 selectionModel 의 청취자를 작성 및 인스톨 합니다. |
void |
installUI (JComponent c)
installDefaults() ,installListeners() , 및 installKeyboardActions() 를 순서에 호출해,this.list 를 초기화합니다. |
int |
locationToIndex (JList list,
Point location)
리스트의 좌표계내의 지정된 위치에 가장 가까운, 지정된 JList 내의 셀 인덱스를 돌려줍니다. |
protected void |
maybeUpdateLayoutState ()
updateLayoutStateNeeded 가 제로가 아니면, updateLayoutState()을 호출해 updateLayoutStateNeeded 를 리셋 합니다. |
void |
paint (Graphics g,
JComponent c)
Graphics 객체의 clipRect 와 교차하는 행을 그립니다. |
protected void |
paintCell (Graphics g,
int row,
Rectangle rowBounds,
ListCellRenderer cellRenderer,
ListModel dataModel,
ListSelectionModel selModel,
int leadIndex)
List 의 셀을 1 개 그립니다. |
protected void |
selectNextIndex ()
1 개전의 행을 선택해, 그것을 강제적으로 가시로 합니다. |
protected void |
selectPreviousIndex ()
1 개전의 행을 선택해, 그것을 강제적으로 가시로 합니다. |
protected void |
uninstallDefaults ()
null 에 명시적으로 오버라이드(override)되어 있지 않은 JList 의 프로퍼티을 설정합니다. |
protected void |
uninstallKeyboardActions ()
installKeyboardActions 로부터 인스톨 된 키보드 액션의 등록을 해제합니다. |
protected void |
uninstallListeners ()
JList, 그 모델, 및 selectionModel 의 청취자를 삭제합니다. |
void |
uninstallUI (JComponent c)
uninstallListeners() ,uninstallKeyboardActions() , 및 uninstallDefaults() 를 순서에 호출해,this.list 의 초기화를 해제합니다. |
protected void |
updateLayoutState ()
cellHeight (또는 cellHeights) 및 cellWidth 의 값을, 현재의 폰트와 fixedCellWidth, fixedCellHeight, 및 prototypeCellValue 의 현재의 값을 기본으로 해 다시 계산합니다. |
클래스 javax.swing.plaf. ComponentUI 로부터 상속된 메소드 |
---|
contains , getAccessibleChild , getAccessibleChildrenCount , getMaximumSize , getMinimumSize , update |
클래스 java.lang. Object 로부터 상속된 메소드 |
---|
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
필드의 상세 |
---|
protected JList list
protected CellRendererPane rendererPane
protected FocusListener focusListener
protected MouseInputListener mouseInputListener
protected ListSelectionListener listSelectionListener
protected ListDataListener listDataListener
protected PropertyChangeListener propertyChangeListener
protected int[] cellHeights
protected int cellHeight
protected int cellWidth
protected int updateLayoutStateNeeded
protected static final int modelChanged
protected static final int selectionModelChanged
protected static final int fontChanged
protected static final int fixedCellWidthChanged
protected static final int fixedCellHeightChanged
protected static final int prototypeCellValueChanged
protected static final int cellRendererChanged
생성자 의 상세 |
---|
public BasicListUI()
메소드의 상세 |
---|
protected void paintCell(Graphics g, int row, Rectangle rowBounds, ListCellRenderer cellRenderer, ListModel dataModel, ListSelectionModel selModel, int leadIndex)
paint(java.awt.Graphics, javax.swing.JComponent)
public void paint(Graphics g, JComponent c)
ComponentUI
내의 paint
g
- 페인트 대상의 Graphics
문맥c
- 페인트 되는 컴퍼넌트.
이 인수는 일반적으로 무시되지만,
UI 객체에 상태가 없고, 복수의 컴퍼넌트에 공유되고 있는 경우는
사용되는 일이 있는paintCell(java.awt.Graphics, int, java.awt.Rectangle, javax.swing.ListCellRenderer, javax.swing.ListModel, javax.swing.ListSelectionModel, int)
public int getBaseline(JComponent c, int width, int height)
ComponentUI
내의 getBaseline
c
- 요구되는 JComponent
baselinewidth
- baseline를 취득하는 폭height
- baseline를 취득하는 높이
NullPointerException
- c
가 null
의 경우
IllegalArgumentException
- 폭 또는 높이가 0 보다 작은 경우JComponent.getBaseline(int, int)
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
ComponentUI
내의 getBaselineResizeBehavior
c
- baseline의 사이즈 변경의 동작을 돌려주는 JComponent
NullPointerException
- c
가 null
의 경우JComponent.getBaseline(int, int)
public Dimension getPreferredSize(JComponent c)
배치 방향 | 적절한 사이즈 |
---|---|
JList.VERTICAL | 리스트의 preferredSize 는, 행의 높이의 합계와 셀의 최대폭입니다. JList.fixedCellHeight 가 지정되고 있는 경우, 행의 높이의 합계는 (cellVerticalMargins + fixedCellHeight) * model.getSize()가 됩니다. 여기서 rowVerticalMargins 는, 포커스를 나타내는 노란 아우트라인을 draw 하기 위해서 할당하는 영역에 상당합니다. 같이 fixedCellWidth 가 지정되고 있는 경우는, 셀의 고정폭을 사용합니다. |
JList.VERTICAL_WRAP | 가시의 행수가 0 보다 큰 경우, preferredHeight 는, 셀의 최대의 높이 * visibleRowCount 가 됩니다. 가시의 행수가 0 이하의 경우, 적절한 높이는, 현재의 리스트의 높이와 셀의 최대의 높이중 높은 편이 됩니다. 적절한 폭은, 셀의 최대폭 * 필요한 렬수, 가 됩니다. 여기서, 필요한 렬수는 리스트의 높이/셀의 최대의 높이입니다. 셀의 최대의 높이는, 셀의 고정의 높이가 되는지, 모든 셀에 대해서 반복해 ListCellRenderer 로부터 최대의 높이를 검색하는 것으로써 정해집니다. |
JList.HORIZONTAL_WRAP | 가시의 행수가 0 보다 큰 경우, preferredHeight 는, 셀의 최대의 높이 * adjustedRowCount 가 됩니다. 여기서, visibleRowCount 는, 렬수의 지정에 사용됩니다. 수평에 배치하기 위해(때문에), 행수는 렬수로부터 정해집니다. 예를 들어, 10 항목의 모델로 가시행수가 8 이라고 합니다. 표시에 필요한 열은 2 열입니다만, 8 행이나 필요없고, 5 행으로 끝납니다. 따라서, adjustedRowCount 는 5 가 됩니다.
가시행수가 0 이하의 경우, 적절한 높이는 렬수에 따릅니다. 적어도 1 열로, |
Insets
는 list.getInsets()
로부터 정해집니다.
ComponentUI
내의 getPreferredSize
c
- JList 컴퍼넌트
JComponent.getPreferredSize()
,
LayoutManager.preferredLayoutSize(java.awt.Container)
protected void selectPreviousIndex()
JList.ensureIndexIsVisible(int)
protected void selectNextIndex()
JList.ensureIndexIsVisible(int)
protected void installKeyboardActions()
BasicListUI
를 관련지을 수 있는 JList
상의 키보드 바인딩을 돌려줍니다. 이 메소드는, installUI()의 실행시에 불려 갑니다.
installUI(javax.swing.JComponent)
protected void uninstallKeyboardActions()
installKeyboardActions
로부터 인스톨 된 키보드 액션의 등록을 해제합니다. 이 메소드는, uninstallUI()의 실행시에 불려 갑니다. 서브 클래스는, installUI 의 실행시에 등록된 키보드 액션을 모두, 여기서 삭제할 필요가 있습니다.
installUI(javax.swing.JComponent)
protected void installListeners()
installUI(javax.swing.JComponent)
,
uninstallListeners()
protected void uninstallListeners()
uninstallUI(javax.swing.JComponent)
,
installListeners()
protected void installDefaults()
uninstallDefaults()
,
installUI(javax.swing.JComponent)
,
CellRendererPane
protected void uninstallDefaults()
installDefaults()
,
uninstallUI(javax.swing.JComponent)
,
CellRendererPane
public void installUI(JComponent c)
installDefaults()
,installListeners()
, 및 installKeyboardActions()
를 순서에 호출해,this.list
를 초기화합니다.
ComponentUI
내의 installUI
c
- UI 위양이 인스톨 되고 있는 컴퍼넌트installDefaults()
,
installListeners()
,
installKeyboardActions()
public void uninstallUI(JComponent c)
uninstallListeners()
,uninstallKeyboardActions()
, 및 uninstallDefaults()
를 순서에 호출해,this.list
의 초기화를 해제합니다. this.list 는 null 로 설정됩니다.
ComponentUI
내의 uninstallUI
c
- 이 UI 위양을 삭제하는 컴퍼넌트.
이 인수는 일반적으로 무시되지만,
UI 객체에 상태가 없고, 복수의 컴퍼넌트에 공유되고 있는 경우는
사용되는 일이 있는uninstallListeners()
,
uninstallKeyboardActions()
,
uninstallDefaults()
public static ComponentUI createUI(JComponent list)
public int locationToIndex(JList list, Point location)
JList
내의 셀 인덱스를 돌려줍니다. 셀이 실제로 그 지정된 위치를 포함할지 어떨지를 판정하려면 ,getCellBounds
의 규정 대로, 점과 셀의 경계를 비교합니다. 이 메소드는, 리스트의 모델이 빈 상태(empty)의 경우,-1
를 돌려줍니다.
ListUI
내의 locationToIndex
list
- 리스트location
- 점의 좌표
-1
NullPointerException
- location
가 null 의 경우public Point indexToLocation(JList list, int index)
JList
내의 원점을 돌려줍니다. 인덱스가 유효하지 않은 경우는,null
를 돌려줍니다.
ListUI
내의 indexToLocation
list
- 리스트index
- 셀의 인덱스
null
public Rectangle getCellBounds(JList list, int index1, int index2)
작은 편의 인덱스가 리스트의 셀의 범위외에 있는 경우, 이 메소드는 null
를 돌려줍니다. 작은 편의 인덱스가 유효해도, 큰 편의 인덱스가 리스트의 범위외에 있는 경우, 최초의 인덱스의 경계만이 돌려주어집니다. 그렇지 않은 경우, 유효한 범위의 경계가 돌려주어집니다.
ListUI
내의 getCellBounds
list
- 리스트index1
- 범위의 선두의 인덱스index2
- 범위의 2 번째의 인덱스
null
protected int getRowHeight(int row)
convertYToRow(int)
,
convertRowToY(int)
,
updateLayoutState()
protected int convertYToRow(int y0)
getRowHeight(int)
,
updateLayoutState()
protected int convertRowToY(int row)
getRowHeight(int)
,
updateLayoutState()
protected void maybeUpdateLayoutState()
updateLayoutState()
protected void updateLayoutState()
maybeUpdateLayoutState()
protected MouseInputListener createMouseInputListener()
class MyListUI extends BasicListUI { protected MouseInputListener createMouseInputListener() { return new MyMouseInputHandler(); } public class MyMouseInputHandler extends MouseInputHandler { public void mouseMoved(MouseEvent e) { // do some extra work when the mouse moves super.mouseMoved(e); } } }
BasicListUI.MouseInputHandler
,
installUI(javax.swing.JComponent)
protected FocusListener createFocusListener()
protected ListSelectionListener createListSelectionListener()
class MyListUI extends BasicListUI { protected ListSelectionListener createListSelectionListener() { return new MySelectionListener(); } public class MySelectionListener extends ListSelectionHandler { public void valueChanged(ListSelectionEvent e) { // do some extra work when the selection changes super.valueChange(e); } } }
BasicListUI.ListSelectionHandler
,
installUI(javax.swing.JComponent)
protected ListDataListener createListDataListener()
class MyListUI extends BasicListUI { protected ListDataListener createListDataListener() { return new MyListDataListener(); } public class MyListDataListener extends ListDataHandler { public void contentsChanged(ListDataEvent e) { // do some extra work when the models contents change super.contentsChange(e); } } }
ListDataListener
,
JList.getModel()
,
installUI(javax.swing.JComponent)
protected PropertyChangeListener createPropertyChangeListener()
class MyListUI extends BasicListUI { protected PropertyChangeListener createPropertyChangeListener() { return new MyPropertyChangeListener(); } public class MyPropertyChangeListener extends PropertyChangeHandler { public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName(). equals("model")) { // do some extra work when the model changes } super.propertyChange(e); } } }
PropertyChangeListener
,
installUI(javax.swing.JComponent)
|
JavaTM Platform Standard Ed. 6 |
|||||||||
앞의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
개요 : 상자 | 필드 | 생성자 | 메소드 | 상세 : 필드 | 생성자 | 메소드 |
Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.