|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.zfqjava.swing.cell.AbstractCellRenderer
public abstract class AbstractCellRenderer
AbstractCellRenderer provides a abstract cell renderer,
can renderer JList, JTable,
JTree.
| Field Summary | |
|---|---|
protected static Border |
noFocusBorder
The border used when the cell has no focus. |
protected boolean |
useFocusColor
True use the focus color when the cell has focus. |
| Constructor Summary | |
|---|---|
AbstractCellRenderer()
|
|
| Method Summary | |
|---|---|
CellProvider |
getCellProvider()
Returns the cell provider to add extra info for current renderer. |
Component |
getCellRendererComponent(Container host,
Object value,
boolean isSelected,
boolean cellHasFocus)
Return a component that has been configured to display the specified value. |
CellRendererComponentType |
getCellRendererComponentType()
|
abstract Component |
getComponent()
Returns the component for this renderer. |
Component |
getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
Return a component that has been configured to display the specified value. |
Component |
getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
Returns the component used for drawing the cell. |
Component |
getTreeCellRendererComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
Sets the value of the current tree cell to value. |
boolean |
isOpaque()
Returns the opaque property. |
void |
setCellProvider(CellProvider provider)
Sets the cell provider to add extra info for current renderer. |
void |
setCellRendererComponentType(CellRendererComponentType cellRendererComponentType)
|
void |
setOpaque(boolean opaque)
Sets the opaque property. |
protected abstract void |
setValue(Object value)
Sets the value for current renderer. |
void |
setValue(Object value,
boolean isSelected)
Sets the value. |
void |
updateUI()
Updates UI. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Border noFocusBorder
new EmptyBorder(1, 1, 1, 1).
protected boolean useFocusColor
TableCellRenderer.
The default is true.
| Constructor Detail |
|---|
public AbstractCellRenderer()
| Method Detail |
|---|
public Component getCellRendererComponent(Container host,
Object value,
boolean isSelected,
boolean cellHasFocus)
paint method is then called to
"render" the cell. If it is necessary to compute the dimensions
of a list because the list cells do not have a fixed size, this method
is called to generate a component on which getPreferredSize
can be invoked.
host - the renderer component containervalue - the valueisSelected - True if the specified cell was selectedcellHasFocus - True if the specified cell has the focus.
public Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
paint method is then called to
"render" the cell. If it is necessary to compute the dimensions
of a list because the list cells do not have a fixed size, this method
is called to generate a component on which getPreferredSize
can be invoked.
getListCellRendererComponent in interface ListCellRendererlist - The JList we're painting.value - The value returned by list.getModel().getElementAt(index).index - The cells index.isSelected - True if the specified cell was selected.cellHasFocus - True if the specified cell has the focus.
JList,
ListSelectionModel,
ListModel
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
getTableCellRendererComponent in interface TableCellRenderertable - the JTable that is asking the
renderer to draw; can be nullvalue - the value of the cell to be rendered. It is
up to the specific renderer to interpret
and draw the value. For example, if
value
is the string "true", it could be rendered as a
string or it could be rendered as a check
box that is checked. null is a
valid valueisSelected - true if the cell is to be rendered with the
selection highlighted; otherwise falsehasFocus - if true, render cell appropriately. For
example, put a special border on the cell, if
the cell can be edited, render in the color used
to indicate editingrow - the row index of the cell being drawn. When
drawing the header, the value of
row is -1column - the column index of the cell being drawn
public Component getTreeCellRendererComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
value.
If selected is true, the cell will be drawn as if
selected. If expanded is true the node is currently
expanded and if leaf is true the node represets a
leaf and if hasFocus is true the node currently has
focus. tree is the JTree the receiver is being
configured for. Returns the Component that the renderer
uses to draw the value.
getTreeCellRendererComponent in interface TreeCellRendererComponent that the renderer uses to draw the valuepublic void updateUI()
public void setOpaque(boolean opaque)
opaque - the opaque propertypublic boolean isOpaque()
public void setCellProvider(CellProvider provider)
provider - the cell providergetCellProvider()public CellProvider getCellProvider()
setCellProvider(com.zfqjava.swing.cell.CellProvider)
public void setValue(Object value,
boolean isSelected)
setValue in interface Renderervalue - the valueisSelected - the select statepublic abstract Component getComponent()
getComponent in interface Rendererprotected abstract void setValue(Object value)
value - the value to rendererpublic CellRendererComponentType getCellRendererComponentType()
public void setCellRendererComponentType(CellRendererComponentType cellRendererComponentType)
|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||