Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InlineCssTextArea paragraph style #289

Closed
FrancescoTaurino opened this issue Apr 16, 2016 · 2 comments
Closed

InlineCssTextArea paragraph style #289

FrancescoTaurino opened this issue Apr 16, 2016 · 2 comments

Comments

@FrancescoTaurino
Copy link

Hi,
Please excuse me for opening another issue, but I need help.

I am using InlineCssTextArea and I would like to highlight the current line, i.e. where the caret is.
I tried this option, but it doesn't seem to work:

area.caretPositionProperty().addListener(e -> {
    newCurrentLine = area.getCurrentParagraph();
    if(newCurrentLine != oldCurrentLine) {              
        area.setParagraphStyle(oldCurrentLine, "-fx-background-color: #FFFFFF;");
        area.setParagraphStyle(newCurrentLine, "-fx-background-color: #F2F2F2;");

        oldCurrentLine = newCurrentLine;
    }
});

oldCurrentLine and newCurrentLine are int.

The idea is to color the new current line and to set white the old one, but background remains always white and it does not change. What's wrong with what I am doing?

Thanks in advance.

@TomasMikula
Copy link
Member

Hi,

not sure why it doesn't work, but if you try the current snapshot version, you can use the :has-caret pseudo class in CSS stylesheet to set style of the current line. The JavaKeywords demo does that now.

@FrancescoTaurino
Copy link
Author

Thanks Thomas, using:

.paragraph-box:has-caret {
    -fx-background-color: #f2f2f2;
}

all the work is done.
Thank you very much, I hope this can be helpful for someone else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants