Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotating label 90 degrees takes up unnecessary horizontal space

This question is based on Javafx rotate Label issue, but because this post is outdated and has no satisfying answer, I would like to mention it again.

The problem is:

When rotating a label for 90 or 270 degrees, firstly the text is being truncated because it has not the right minimum width. When I set the minimum width, the text is not being truncated anymore.

However, the minimum width is also set in the horizontal direction, as shown below:

Label issue with minimum width

On the left is the situation as it is now in Java 8u40, and on the right is how I like it to be (and which is the most logical way in my opinion).

I have just used this code:

Label label = new Label("This is a label.");
label.setRotate(270);
label.setMinWidth(200);

I have added the label to a AnchorPane, which is not part of the problem I except. I also tried @James_D workaround (https://community.oracle.com/thread/3514254), which did not work for me either.

So my question is:

Is this a known bug, and if so: is there any chance it will be fixed in the future? Also, is there another workaround possible (apart from placing the label in an image)?

like image 391
bashoogzaad Avatar asked Mar 13 '15 11:03

bashoogzaad


Video Answer


1 Answers

In my opinion it´s a bug. I did a test with a JavaFX app with rotating text on Windows (running Oracle JavaFX, JDK1.8.0.60j and then I moved it to Raspberry Pi. The Pi was running Open JavaFX. In Open JavaFX the rotation is performed correctly, while the Oracle JavaFX shows the behaviour you decribed here.

like image 125
TJL Avatar answered Sep 18 '22 13:09

TJL