// g.drawLine(20, y + offset, x - 20, y + offset);
}
- g.drawString(label, x, y + offset);
+ if(label.contains("Secondary Structure Consensus")) {
+ //label.replace("Secondary Structure Consensus", "Secondary Structure Consensus" + "\n");
+ // Split the string into lines using the newline character
+ String[] lines = label.split("(?<=Secondary Structure Consensus)", 2);
+
+ // Set the starting y position
+ int lineHeight = g.getFontMetrics().getHeight();
+ labelWidth = Math.max(fm.stringWidth(lines[0]), fm.stringWidth(lines[1])) + 3;
+
+ x = width - labelWidth;
+ for (int k = 0; k < lines.length; k++) {
+ // Draw each line, offsetting the y position by lineHeight for each line
+ g.drawString(lines[k].trim(), x, y + offset +(k * lineHeight));
+ }
+ }
+ else {
+ g.drawString(label, x, y + offset);
+ }
}
}
lastSeqRef = aa[i].sequenceRef;