source: src/main/java/genius/gui/renderer/RepItemTableCellRenderer.java@ 337

Last change on this file since 337 was 1, checked in by Wouter Pasman, 6 years ago

Initial import : Genius 9.0.0

File size: 884 bytes
Line 
1package genius.gui.renderer;
2
3import java.awt.Component;
4
5import javax.swing.JLabel;
6import javax.swing.JTable;
7import javax.swing.table.DefaultTableCellRenderer;
8
9import genius.core.repository.PartyRepItem;
10import genius.core.repository.RepItem;
11
12/**
13 * Renders RepItems, using {@link PartyRepItem#getName()} if possible, or
14 * toString otherwise. Identical to {@link RepItemListCellRenderer} except that
15 * this is for tables.
16 */
17
18@SuppressWarnings("serial")
19public class RepItemTableCellRenderer extends DefaultTableCellRenderer {
20
21 @Override
22 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
23 int row, int column) {
24 JLabel comp = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
25 comp.setText(RepItemListCellRenderer.getText((RepItem) value));
26 return comp;
27 }
28}
Note: See TracBrowser for help on using the repository browser.