import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
+import java.util.ArrayList;
+import java.util.List;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
{
scalestartx += 5;
}
-
+ List<Object[]> marks = new ArrayList<Object[]>();
String string;
int maxX = 0, refN, iadj;
// todo: add a 'reference origin column' to set column number relative to
for (int i = scalestartx; i < endx; i += 5)
{
+ Object[] amark = new Object[3];
if (((i - refSp) % 10) == 0)
{
if (refSeq == null)
string = String.valueOf(refN) + refSeq.getCharAt(iadj);
}
}
- if ((i - startx - 1) * avCharWidth > maxX)
+ amark[0] = Boolean.TRUE;
+ amark[1] = Integer.valueOf(i - startx - 1);
+ amark[2] = string;
+
+ }
+ else
+ {
+ amark[0] = Boolean.FALSE;
+ amark[1] = Integer.valueOf(i - startx - 1);
+ amark[2] = null;
+ }
+ marks.add(amark);
+ }
+ maxX=0;
+ for (Object[] mark : marks)
+ {
+ boolean major = Boolean.valueOf((Boolean) mark[0]);
+ int mpos = ((Integer) mark[1]).intValue(); // (i - startx - 1)
+ String mstring = (String) mark[2];
+ if (mstring != null)
+ {
+ if (mpos * avCharWidth > maxX)
{
- gg.drawString(string, (i - startx - 1) * avCharWidth, y);
- maxX = (i - startx + 1) * avCharWidth + fm.stringWidth(string);
+ gg.drawString(mstring, mpos * avCharWidth, y);
+ maxX = (mpos + 2) * avCharWidth + fm.stringWidth(mstring);
}
-
- gg.drawLine(((i - startx - 1) * avCharWidth) + (avCharWidth / 2),
- y + 2,
- ((i - startx - 1) * avCharWidth) + (avCharWidth / 2), y
- + (yOf * 2));
+ }
+ if (major)
+ {
+ gg.drawLine((mpos * avCharWidth) + (avCharWidth / 2), y + 2,
+ (mpos * avCharWidth) + (avCharWidth / 2), y + (yOf * 2));
}
else
{
- gg.drawLine(((i - startx - 1) * avCharWidth) + (avCharWidth / 2), y
- + yOf,
- ((i - startx - 1) * avCharWidth) + (avCharWidth / 2), y
- + (yOf * 2));
+ gg.drawLine((mpos * avCharWidth) + (avCharWidth / 2), y + yOf,
+ (mpos * avCharWidth) + (avCharWidth / 2), y + (yOf * 2));
}
}
-
if (av.hasHiddenColumns())
{
if (reveal != null && reveal[0] > startx && reveal[0] < endx)