Vertical Alignment for RowNumberMargin

This forum is used by users to request and discuss new product features. Please do not use this forum for technical support including bug reports.

Moderator: JIDE Support

Forum rules
Product suggestions only. Please do not use this forum for technical support including bug reports.

Vertical Alignment for RowNumberMargin

Postby Jason Rising » Thu Apr 21, 2022 1:19 pm

We would like to have vertical alignment for the RowNumberMargin. Currently, we overloaded the paintRowMargin method as follows:

Code: Select all
@Override
public void paintRowMargin(final Graphics g, final Rectangle rect, final int row) {
   final int visualRow = ((RowMarginSupport) _marginSupport).visualRowToActualRow(row);
   if (visualRow != -1) {
      final int lineNumber = visualRow + 1;
      final String s = "" + lineNumber;
      g.setColor(getForeground());
      g.setFont(getFont());

      // Override default behavior to paint relative to the top of the row
      g.drawString(s, rect.x + rect.width - getFontMetrics(getFont()).stringWidth(s),
            rect.y + getFontMetrics(getFont()).getLeading() + getFontMetrics(getFont()).getAscent()
                  + ((RowMarginSupport) _marginSupport).getBaselineAdjustment() - 1);
   }
}
Jason Rising
 
Posts: 11
Joined: Thu Jun 24, 2021 10:39 am

Re: Vertical Alignment for RowNumberMargin

Postby JIDE Support » Thu Apr 21, 2022 3:45 pm

I think that's fine. As long as we leave you a way to customize, it is good enough.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to Product Suggestions

Who is online

Users browsing this forum: No registered users and 16 guests

cron