0

This is the image I am using as my app background.

https://i.stack.imgur.com/VxeYR.png

As you can see, there are cells in this image, and I want to make labels appear in the centre of each cell. How can I place labels on the absolute coordinates of the centre of each cell?

Please help me do this!

Adam C
  • 1
  • 3
  • It depends on what you mean by making the labels "appear in the centre of each cell", especially the vertical alignment. Do you want the text baseline to be at the center, or the center of uppercase letters to be in the center, or the center of lowercase letters above the baseline to be in the center, or the midpoint of the ascent and descent to be in the center, or ...? – FredK Mar 07 '16 at 22:07
  • It's not a good practice to draw the cells in the background image and it's also not recommended to use an absolute position. You should use a `GridPane` to add the cells. – agi Mar 07 '16 at 22:11
  • @FredK I want the entire label to be centred at the absolute point on the cell. The centre of the label will align with the centre of each cell. – Adam C Mar 07 '16 at 22:11
  • 1
    You will really struggle with calculating the absolute positiones for different screen sizes etc. Use a `GridPane ` and add `TextViews` with a white background or whatever the cell should look like. The text can be automatically centered in the `TextView` without calculating absolute positions. – agi Mar 07 '16 at 22:18

0 Answers0