Scaling a rotated component


What would be a suggestion for scaling a previously rotated component?

Just setting the size to proportion of width/height fails because these still operate on the sub-component but on a rotated axis.


I've tried resetting rotation, scaling, then rotating again, but this still doesn't get the rotation angle right.


Should I be looking at a manual AffineTransformation, or should I try to calculate the rotation angle? I've tried that using getAngleToPoint, but the bounds of the box never reflect the rotation.

Can anyone with more background in math help me solve these values, or if there is a different technique, please share.