I’m developing an application to design a key system. The main interface consists of a “matrix” of checkboxes which show the correspondence between locks and keys. It’s possible to give each lock and key a name to aid in distributing them to the appropriate owner. In order to save space, I’d like to tilt the textboxes for lock names a bit.


My initial attempt is shown in the screenshot (with borders painted red), as well as a drawing of what my goal is. The JXTransformer class lets me rotate the fields, and for now the fields are just positioned absolutely with no layout manager.
The problem is that the rotated text fields seem to have an opaque “background” which obscures other text fields in a random manner. I’m unsure if this is an artifact of JXTransformer or if it’s simply not possible to have components overlap in Swing.
I’d greatly appreciate any help or proof that this is indeed impossible.
EDIT: just to clarify, the layout is frozen and does not need to allow resizing.
It depends somewhat on the version of Java you are using. Alexander Potochkin wrote a library called JXLayer, which you can use for pre Java 7. A short introduction to this you can find here:
JXLayer introduction
This has evolved into JLayer which you now can find in Java 7. A few basic demonstrations of this you can find on the following page:
JLayer video
Basically what you could do is to write a UI on top of you components, that does a 2D rotation. I have used this approach with success in the past.