org.bidib.wizard.mvc.booster.view.TemperatureCellRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bidibwizard-client Show documentation
Show all versions of bidibwizard-client Show documentation
jBiDiB BiDiB Wizard Client Application POM
package org.bidib.wizard.mvc.booster.view;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
public class TemperatureCellRenderer extends DefaultTableCellRenderer {
private static final long serialVersionUID = 1L;
public TemperatureCellRenderer() {
}
public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (value instanceof Integer) {
int val = ((Integer) value).intValue();
StringBuilder sb = new StringBuilder();
sb.append(val).append(" \u00b0C");
setText(sb.toString());
}
else {
setText(null);
}
return this;
}
}