Q: Rotated labels, layout and reflow

Tom Eugelink tbee at tbee.org
Sat Dec 15 08:18:30 UTC 2018


It's a bit grey. If this goes towards a bug in the layout, it could be considered OpenJFX development. It could also go towards a patch, because instead of using Canvas I would suggest (John) to look at the HBox and see if you can figure out why it is not doing what you want. And if that is too complex; write a layout that does this, and contribute it to OpenJFX, ControlsFX or JFXtras. (I believe OpenJFX also is the sum of all the extending libraries, not making the suck-it-all-in mistake Java made.) The layout logic should be similar to when doing it in Canvas, only reusable.

Also I have found that when rotating is involved, a lot of layouts do not what you expect them to do. Have you given MigLayout a try? It sometimes has surprising results (both positive and negative) ;-)




On 15-12-2018 03:14, John-Val Rose wrote:
> My feedback would to ask this kind of question on a more appropriate list or forum.
>
> I believe this list is exclusively to discuss issues related to the development of OpenJFX itself.
>
> Graciously,
>
> John-Val
>
>> On 15 Dec 2018, at 12:50, John Hendrikx <hjohn at xs4all.nl> wrote:
>>
>>
>> (Sent this twice, first message got sent prematurely)
>>
>> Hi list,
>>
>> I get the impression that rotation of Labels needs to be something that is directly supported by Label instead of handling this with a Rotate transform (setRotate).
>>
>> I want to achieve something quite trivial if no rotation was involved, a layout like this, an HBox with 3 labels in it:
>>
>>   +-HBox------------------------------------------------------------+
>>   |            | Long text that can reflow to multiple |            |
>>   | Short Text | lines if needed...                    | Short Text |
>>   |            |                                       |            |
>>   +-----------------------------------------------------------------+
>>
>> The center label would be given grow Priority.ALWAYS.
>>
>> Now... the rotated version just goes wrong in so many ways.
>>
>> First, I need to use Groups in order to get the layout bounds reasonable... however, these are unaware of how much space is available and will kill the reflow in the center Label.
>>
>> If I put a Group around the whole HBox, the same issue occurs as the Group blocks any awareness of how big the area is where the three labels are going to appear, effectively rendering the center label as one long line.
>>
>> What I'm actually trying to achieve is a layout that looks like this:
>>
>>    +----+-------------------+
>>    |  T |                   |
>>    |  e |                   |
>>    |  x |                   |
>>    |  t |                   |
>>    +----+                   |
>>    |    |                   |
>>    |  T |                   |
>>    |  e |       Image       |
>>    |  x |                   |
>>    |  t |                   |
>>    |    |                   |
>>    +----+                   |
>>    |  T |                   |
>>    |  e |                   |
>>    |  x |                   |
>>    |  t |                   |
>>    +----+-------------------+
>>
>> Except of course the left area should be the rotated HBox.
>>
>> Is this really not possible at the moment, without using a Canvas or something and a lot of layout calculations (to get reflow working)?
>>
>> Any feedback appreciated :)
>>
>> --John




More information about the openjfx-dev mailing list