From 140c8de58b9a30d013e7fcc3904df91fa81880fc Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 16 Jul 2019 11:23:35 +0100 Subject: [PATCH] JAL-2987 tolerate null double values when formatting JTable --- src/jalview/fts/core/DecimalFormatTableCellRenderer.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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); -- 1.7.10.2