You may want yo create something like this.


Now, even using CSS this is not possible if you directly add a label on the TextArea itself and change its z-location. I came across a post somewhere in the Stack Overflow forum and user jewelsea created a custom made BorderedTitledPane class that simulates a Titled Border in Java’s Swing.

Using this class I added a TextArea to the BorderedTitledPane and with a little CSS tweaking, removed the border and changed its z-location so that the Label title will be positioned right between the border of the TextArea.

Here is the BorderedTitlePane.

And here is the CSS code to make that possible.

Doing this in Swing is possibly tedious but Java FX and CSS gives developers so much flexibility creating new layouts.

To use the class, call it like this.

And add it to the scene’s container.

Related Posts Plugin for WordPress, Blogger...