|
JavaTM Platform Standard Ed. 6 |
|||||||||
전의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 |
public interface TableCellRenderer
이 인터페이스는,JTable
의 셀의 렌더링이 될 가능성이 있는 객체가 요구하는 메소드를 정의합니다.
메소드의 개요 | |
---|---|
Component |
getTableCellRendererComponent (JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
셀을 draw 하는데 사용되는 컴퍼넌트를 돌려줍니다. |
메소드의 상세 |
---|
Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
테이블의 현재의 드래그 & 드롭 위치를 나타내는 셀이 있으면,TableCellRenderer
도 이 셀을 draw 하기 위해서 사용됩니다. 이 렌더링이 드래그 & 드롭 위치의 draw를 고려하는 경우, 테이블을 직접 조회해, 지정의 행 및 열이 드롭 위치를 나타내고 있는지 어떤지를 확인하게 되어 있습니다.
JTable.DropLocation dropLocation = table.getDropLocation(); if (dropLocation ! = null && ! dropLocation.isInsertRow() && ! dropLocation.isInsertColumn() && dropLocation.getRow() == row && dropLocation.getColumn() == column) { // this cell represents the current drop location // so render it specially, perhaps with a different color }
인쇄 조작중은, 인쇄 결과에 선택 범위나 포커스가 표시되는 것을 막기 위해,isSelected
및 hasFocus
의 값을 false
로 해 이 메소드를 호출합니다. 테이블을 인쇄할지 어떨지에 근거해 그 외의 커스터마이즈를 실시하려면 ,JComponent.isPaintingForPrint()
의 반환값을 확인합니다.
table
- draw 하는 렌더링을 조회하는 JTable
.
null
도 가능value
- 렌더링 되는 셀의 값. 값을 해석 및 draw 하는 방법은 렌더링에 따라서 다르다.
예를 들어, value
가
캐릭터 라인 "true" 인 경우는
캐릭터 라인으로서 draw 되는지, 체크된 체크 박스로서 draw 된다.
null
도 유효한 값isSelected
- 셀이 하이라이트로 draw 되고 있는 경우는 true, 그렇지 않은 경우는 falsehasFocus
- true 의 경우, 셀을 적절히 draw 한다. 예를 들어 셀이 편집 가능한 경우는,
셀에 특별한 경계를 붙여 편집을 나타내는 색으로 draw 하는row
- draw 되는 셀의 행 인덱스. 헤더를 draw 하는 경우,
row
의 값은 -1column
- draw 되는 셀의 열인덱스- 관련 항목:
JComponent.isPaintingForPrint()
|
JavaTM Platform Standard Ed. 6 |
|||||||||
전의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 |
Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.