From: amwaterhouse Date: Thu, 4 Nov 2004 18:00:13 +0000 (+0000) Subject: Move drawing out of repaint method X-Git-Tag: Release_2_0~945 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ff5e0e32f8f3d12223499bf6c2dae114817c39bf;p=jalview.git Move drawing out of repaint method --- diff --git a/src/jalview/gui/ScorePanel.java b/src/jalview/gui/ScorePanel.java index d2b472c..b4bb3c9 100755 --- a/src/jalview/gui/ScorePanel.java +++ b/src/jalview/gui/ScorePanel.java @@ -43,11 +43,18 @@ public class ScorePanel extends JPanel this.setToolTipText(null); } + + public void paintComponent(Graphics g) { - setPreferredSize(new Dimension( this.getWidth(), 80)); + setPreferredSize(new Dimension( this.getWidth(), 80)); + drawScorePanel(g, getWidth(), av.getStartRes(), av.getChunkWidth()); + } + + public void drawScorePanel(Graphics g, int width, int startRes, int length) + { g.setColor(Color.white); - g.fillRect(0, 0, this.getWidth(), 80); + g.fillRect(0, 0,width, 80); g.setColor(Color.blue); g.setFont(av.getFont()); @@ -58,7 +65,7 @@ public class ScorePanel extends JPanel char character; - int i=0, iSize = av.getChunkWidth(); + int i=0, iSize = length; if(iSize > freq.size()) iSize=freq.size(); @@ -66,7 +73,7 @@ public class ScorePanel extends JPanel { g.setColor(Color.blue); - Hashtable hash = (Hashtable) freq.elementAt(i+av.getStartRes()); + Hashtable hash = (Hashtable) freq.elementAt(i+startRes); if(hash.containsKey("maxResidue")) characters = hash.get("maxResidue").toString(); else