From 6316e3dec392d6bed2f20f02307b1d7edd34038a Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 18 Jul 2016 14:10:40 +0100 Subject: [PATCH] JAL-2015 restore check for null colour in paint() --- src/jalview/appletgui/FeatureSettings.java | 41 +++++++++++++++------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/jalview/appletgui/FeatureSettings.java b/src/jalview/appletgui/FeatureSettings.java index bfac241..9733c86 100755 --- a/src/jalview/appletgui/FeatureSettings.java +++ b/src/jalview/appletgui/FeatureSettings.java @@ -763,28 +763,31 @@ public class FeatureSettings extends Panel implements ItemListener, public void paint(Graphics g) { Dimension d = getSize(); - if (col.isColourByLabel()) + if (col != null) { - g.setColor(Color.white); - g.fillRect(d.width / 2, 0, d.width / 2, d.height); - /* - * g.setColor(Color.black); Font f=g.getFont().deriveFont(9); - * g.setFont(f); - * - * // g.setFont(g.getFont().deriveFont( // - * AffineTransform.getScaleInstance( // - * width/g.getFontMetrics().stringWidth("Label"), // - * height/g.getFontMetrics().getHeight()))); g.drawString("Label", - * width/2, 0); - */ + if (col.isColourByLabel()) + { + g.setColor(Color.white); + g.fillRect(d.width / 2, 0, d.width / 2, d.height); + /* + * g.setColor(Color.black); Font f=g.getFont().deriveFont(9); + * g.setFont(f); + * + * // g.setFont(g.getFont().deriveFont( // + * AffineTransform.getScaleInstance( // + * width/g.getFontMetrics().stringWidth("Label"), // + * height/g.getFontMetrics().getHeight()))); g.drawString("Label", + * width/2, 0); + */ - } - else if (col.isGraduatedColour()) - { - Color maxCol = col.getMaxColour(); - g.setColor(maxCol); - g.fillRect(d.width / 2, 0, d.width / 2, d.height); + } + else if (col.isGraduatedColour()) + { + Color maxCol = col.getMaxColour(); + g.setColor(maxCol); + g.fillRect(d.width / 2, 0, d.width / 2, d.height); + } } if (hasLink) -- 1.7.10.2