From: amwaterhouse Date: Thu, 17 Mar 2005 10:38:59 +0000 (+0000) Subject: idwidth is calculated in alignpanel, not idcanvas X-Git-Tag: Release_2_0~582 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=185f40ac45106467bad7a58d1b0f6fd389f0d54c;p=jalview.git idwidth is calculated in alignpanel, not idcanvas --- diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 9e64b1e..a526fb1 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -36,7 +36,9 @@ public class IdCanvas extends JPanel gg.setColor(Color.black); } - String string = s.getName() + "/" + s.getStart() + "-" + s.getEnd(); + String string = s.getName(); + if(av.getShowFullId()) + string = s.getDisplayId(); gg.drawString(string,0,AlignmentUtil.getPixelHeight(starty,i,charHeight) + ypos + charHeight- (charHeight/5)); @@ -45,7 +47,10 @@ public class IdCanvas extends JPanel public void paintComponent(Graphics gg) { AlignmentI al = av.alignment; int charHeight = av.charHeight; - gg.setFont(av.getFont()); + Font italic = new Font(av.getFont().getName(), Font.ITALIC, av.getFont().getSize()); + + gg.setFont(italic); + //Fill in the background gg.setColor(Color.white); @@ -103,7 +108,9 @@ public class IdCanvas extends JPanel charHeight); gg.setColor(currentTextColor); - String string = al.getSequenceAt(i).getDisplayId(); + String string = al.getSequenceAt(i).getName(); + if(av.getShowFullId()) + string = al.getSequenceAt(i).getDisplayId(); gg.drawString(string, 0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + charHeight - (charHeight / 5)); @@ -111,35 +118,4 @@ public class IdCanvas extends JPanel } } - - - public Dimension getLabelWidth() - { - if(getGraphics()==null) - return null; - - FontMetrics fm = this.getGraphics().getFontMetrics(av.font); - AlignmentI al = av.getAlignment(); - - int i = 0; - int idWidth = 0; - - while (i < al.getHeight() && al.getSequenceAt(i) != null) - { - SequenceI s = al.getSequenceAt(i); - String str = s.getDisplayId(); - if (fm.stringWidth(str) > idWidth) - idWidth = fm.stringWidth(str); - i++; - } - - return new Dimension(idWidth + 10,getHeight()); - } - - public Dimension getPreferredSize() - { - return getLabelWidth(); - } - - }