Exemple #1
0
 /**
  * Converts a y co-ordinate to a line index.
  *
  * @param y The y co-ordinate
  */
 public int yToLine(int y) {
   FontMetrics fm = painter.getFontMetrics();
   int height = fm.getHeight();
   return Math.max(0, Math.min(getLineCount() - 1, y / height + firstLine));
 }
Exemple #2
0
 /**
  * Converts a line index to a y co-ordinate.
  *
  * @param line The line
  */
 public int lineToY(int line) {
   FontMetrics fm = painter.getFontMetrics();
   return (line - firstLine) * fm.getHeight() - (fm.getLeading() + fm.getMaxDescent());
 }