question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How To Add Padding Between StyledTextArea And Text Contents?

See original GitHub issue

I have tried the obvious:

styledTextArea.setPadding(new Insets(10, 10, 10, 10));

but it doesn’t seem to work. What is the correct way to add padding between a StyledTextArea and the textual content that it displays?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:30 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
gbmhuntercommented, Nov 17, 2016

I am now using an InlineCssTextArea and removed all style settings, except for padding defined in a CSS file, still no luck 😦.

1reaction
alt-grrcommented, Nov 17, 2016

@gbmhunter I will tell you what I am using.

CSS (Important: :first-paragraph must be styled after :last-paragraph rule!):

.styled-text-area .paragraph-box .paragraph-text {
    -fx-padding: 0 5px 0 5px;
}

.styled-text-area .paragraph-box:last-paragraph .paragraph-text {
    -fx-padding: 0 5px 5px 5px;
}

.styled-text-area .paragraph-box:first-paragraph .paragraph-text {
    -fx-padding: 5px 5px 0 5px;
}

Java (simplified):

textArea = new StyleClassedTextArea();
textArea.setWrapText(true);
textArea.getStylesheets().add(SomeClass.class.getResource("text-area.css").toExternalForm());
new VirtualizedScrollPane<>(textArea);

Result: image

Read more comments on GitHub >

github_iconTop Results From Across the Web

RichTextFX StyleClassedTextArea padding - Stack Overflow
Give more height to StyleClassedTextArea, and try different values for padding. Share. Share a link to this answer.
Read more >
How to Set Text Spacing and Placement in CSS | Webucator
Learn how to set text spacing and placement in the following steps. The letter-spacing property is used to specify the amount of space...
Read more >
padding - CSS: Cascading Style Sheets - MDN Web Docs
An element's padding area is the space between its content and its border. Note: Padding creates extra space within an element.
Read more >
CSS Text Indentation and Spacing - W3Schools
The word-spacing property is used to specify the space between the words in a text. The following example demonstrates how to increase or...
Read more >
I have troubles with a Styled TextArea and tabs - #21 by ...
In that exception file, I have to create, edit and save the rtf (to date, ... “Margin” means the distance from the edge...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found