net.sf.freecol.client.gui.panel
Class NationCellRenderer
java.lang.Object
net.sf.freecol.client.gui.panel.NationCellRenderer
- All Implemented Interfaces:
- javax.swing.table.TableCellRenderer
public final class NationCellRenderer
- extends java.lang.Object
- implements javax.swing.table.TableCellRenderer
A table cell renderer that should be used to display the chosen nation in a table.
It is being used in the players table (StartGamePanel).
|
Method Summary |
private Player |
getPlayer(int i)
|
java.awt.Component |
getTableCellRendererComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
Returns the component used to render the cell's value. |
void |
setData(java.util.List<Player> players,
Player owningPlayer)
Gives this table model the data that is being used in the table. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
nations
private final Nation[] nations
comboBox
private final javax.swing.JComboBox comboBox
players
private java.util.List<Player> players
thisPlayer
private Player thisPlayer
NationCellRenderer
public NationCellRenderer(Nation[] nations)
- The default constructor.
- Parameters:
nations - array of Nation
setData
public void setData(java.util.List<Player> players,
Player owningPlayer)
- Gives this table model the data that is being used in the table.
- Parameters:
players - The players that should be rendered in the table.owningPlayer - The player running the client that is displaying the table.
getPlayer
private Player getPlayer(int i)
getTableCellRendererComponent
public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
- Returns the component used to render the cell's value.
- Specified by:
getTableCellRendererComponent in interface javax.swing.table.TableCellRenderer
- Parameters:
table - The table whose cell needs to be rendered.value - The value of the cell being rendered.hasFocus - Indicates whether or not the cell in question has focus.row - The row index of the cell that is being rendered.column - The column index of the cell that is being rendered.
- Returns:
- The component used to render the cell's value.