All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bidib.wizard.mvc.booster.view.TemperatureCellRenderer Maven / Gradle / Ivy

There is a newer version: 2.0.29
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy