Reputation:
I am working on a little drag-and-drop Java GUI builder.
I'm dragging and dropping JLabels and JButtons on a panel and it's working fine.
Now I want the widgets to be aligned "correctly" next to each other based on the bottom of the font on the widget.
If I line them up at yPosition = 0, it looks like this:
My Label /-----------\
| My button |
\-----------/
But I need to line them up at yPosition = "bottom of their text", like this:
/-----------\
My Label | My button |
\-----------/
So my question is: Given a JLabel or a JButton, how can I determine the yPosition coordinate of the bottom of the font on that widget?
I hope that's clear. Any help is greatly appreciated!
Thanks, Rob
Upvotes: 1
Views: 47