Component layout and granularity Question/Clarification


#1

I have never needed more precision than an integer value to setBounds on a component up until today.

I have a window that has a bunch of X Y lines. These lines are set/drawn using Line which takes floats as its coordinates. I have to plop a few components on this X Y grid and each side of the component has to be perfectly aligned with these lines. When using setBounds I have to play with the actual size of the window, so every thing divides nice etc.

I just discovered PositionedRectangle, and using its applyToComponent method seems to work very well.

My question is:
Is that the way to go when you need just a tiny bit more granularity when it comes to Component placement and size?
Why does PositionedRectangle’ applyToComponent method work better?
Doesn’t it still setBounds with the Component’ setBounds method?


#2

ok i see why it looks better now.

inline int roundDoubleToInt (const double value) throw() { union { int asInt[2]; double asDouble; } n; n.asDouble = value + 6755399441055744.0; ...

forget this post.