From: gmungoc Date: Tue, 16 Jul 2019 10:23:35 +0000 (+0100) Subject: JAL-2987 tolerate null double values when formatting JTable X-Git-Tag: Release_2_11_1_0~31^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=140c8de58b9a30d013e7fcc3904df91fa81880fc;p=jalview.git JAL-2987 tolerate null double values when formatting JTable --- diff --git a/src/jalview/fts/core/DecimalFormatTableCellRenderer.java b/src/jalview/fts/core/DecimalFormatTableCellRenderer.java index 8a8e7ab..2453742 100644 --- a/src/jalview/fts/core/DecimalFormatTableCellRenderer.java +++ b/src/jalview/fts/core/DecimalFormatTableCellRenderer.java @@ -61,16 +61,15 @@ public class DecimalFormatTableCellRenderer extends DefaultTableCellRenderer super.setHorizontalAlignment(JLabel.RIGHT); } + /** + * Adapts the default method to ensure that double values are formatted for + * display + */ @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - if (value == null) - { - return null; - } - - value = formatter.format(value); + value = value == null ? "" : formatter.format(value); return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);