Question about drawing labels

sry for this. my laptop has no internet here so i took a photo. does anyone see why my drawLabel-method doesn’t seem to draw all my labels? i’m sure the bounds are correct because i debugged out the numbers and it works if i don’t override this method.

edit: pls tell me if i’m missing out any relevant information here.

here’s how it looks without overriding the method. so it can’t be the bounds… but what else would cause such weird behaviour?

getLocalBounds instead of getBounds?

1 Like

not sure what you mean. isn’t getLocalBounds() about the whole size of the parent component? i only want the bounds of the 2 upper lines of my grid which works as seen in the 2nd image. but when i write my own method that also uses these exact bounds it somehow only displays the first label correctly

Take a look at the docs. getLocalBounds gives you the components width and height, with x and y set to 0. getBounds gives you the position within the parent, which in your case is only similar for the first label


you are right. i didn’t think this method expects the description of the bounds without the “context” but it works. thanks