-\r
-\r
- public Dimension getLabelWidth()\r
- {\r
- if(getGraphics()==null)\r
- return null;\r
-\r
- FontMetrics fm = this.getGraphics().getFontMetrics(av.font);\r
- AlignmentI al = av.getAlignment();\r
-\r
- int i = 0;\r
- int idWidth = 0;\r
-\r
- while (i < al.getHeight() && al.getSequenceAt(i) != null)\r
- {\r
- SequenceI s = al.getSequenceAt(i);\r
- String str = s.getDisplayId();\r
- if (fm.stringWidth(str) > idWidth)\r
- idWidth = fm.stringWidth(str);\r
- i++;\r
- }\r
-\r
- return new Dimension(idWidth + 10,getHeight());\r
- }\r
-\r
- public Dimension getPreferredSize()\r
- {\r
- return getLabelWidth();\r
- }\r
-\r
-\r