5

I would like to build a custom TextArea (or a Text objects...). Here are the limitations I found in the currently available nodes:

TextArea: provide functionality to apply font styles, select, and "getSelected" text. but it does not allow for applying different style to sub-Strings. A style is applied to the whole TextArea.

HTMLEditor: provides means to apply different styles, but not ways to get what string the user selected.

TextFlow: Allows to program different styles to strings. But it is like a label. Not interactive.

I need something a Text Area where users can type, selected, and my code would know what they selected to give them option to apply font styles to the selected string. So I guess what I need a custom object.

Do you agree? How do I go about that?

5
  • you may need to do use the WebView and use html and css to apply styles to different lines. Commented Dec 5, 2013 at 23:48
  • There is no way to get what string the user selected. I couldn't find any methods that do in the docs. :/ Commented Dec 5, 2013 at 23:59
  • oh sorry, missed that requirement. Perhaps you can either use a Table custom columns or cells (you can attach a listener for which cell or row or whatever was clicked) and you can apply a style per cell, or per row, or column, etc. Commented Dec 6, 2013 at 0:00
  • So the user puts every word in a cell? Commented Dec 6, 2013 at 0:05
  • 1
    I don't really think your question is answerable as it is. But you can get selected text from a HTMLEditor. Commented Dec 6, 2013 at 6:01

1 Answer 1

2

It seems like you are waiting, like many of us, a kind of JEditorPane (or StyledText, for those who uses SWT) in Java FX.

For now, there is no component of this kind in Java FX.You can use CodeAreaFX, but the performances are not at the best.

If you ant to use WebView as a text editor, you can get selected text by using javascript.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Jbprod, Yes. CodeArea is the component required. Tomas, the developer, has added quite a number of cool methods to it and he is updating it constantly. Hopefully I'll be able to post a prototype implemented with CodeArea in the near future. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.