Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Text Widget highlight(javafx highlight words in text field/area)
icon5.gif  Text Widget highlight [message #1708543] Thu, 17 September 2015 11:37 Go to next message
Ionut Ciprian Costan is currently offline Ionut Ciprian CostanFriend
Messages: 5
Registered: March 2015
Junior Member
Hello,

I want to create a "text field" in which the user can introduce Strings and then after a validation is executed some words will be highlighted/underline.
Also it should support text insertion at current cursor location, replace selection with inserted text. would also need a listener at text input.

I thought of using an javafx.scene.web.HTMLEditor but I'm not sure if it supports current selection replacement, or insert at current cursor position.

Also this component will be heavily used throughout my application, many of them will be displayed at the same time in the editor.

Does anyone have any advice on what should I use?

Thank you in advance for any help

Re: Text Widget highlight [message #1708555 is a reply to message #1708543] Thu, 17 September 2015 12:33 Go to previous messageGo to next message
Andy Armaignac is currently offline Andy ArmaignacFriend
Messages: 6
Registered: February 2015
Junior Member
Try RichTextFX from TomasMikula it's work for me. also in the efxclipse 2.0 release the org.eclipse.fx.ui.controls has a StyledTextArea to implement a code editor

[Updated on: Thu, 17 September 2015 12:36]

Report message to a moderator

Re: Text Widget highlight [message #1708569 is a reply to message #1708555] Thu, 17 September 2015 13:57 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Right both of them should work.

We (here at this forum) naturally only provide support for StyledText
and its friends.

Getting started if you use Eclipse is dead simple and explained at:
-
http://tomsondev.bestsolution.at/2015/07/23/defining-source-editors-with-a-dsl/
-
http://tomsondev.bestsolution.at/2015/07/24/developing-a-source-code-editor-in-javafx-without-e4-and-osgi/

We also have a list of features (eg hover-Tooltips, better navigation,
....) people might be interested but we require some funding for them.

Tom

On 17.09.15 14:33, Andy Armaignac wrote:
> Try RichTextFX from TomasMikula it's work for me. also in the efxclipse
> 2.0 release the org.eclipse.fx.ui.controls has a StyledTextArea to
> implement a code editor so you could have a look it
>
Re: Text Widget highlight [message #1708609 is a reply to message #1708569] Fri, 18 September 2015 06:33 Go to previous messageGo to next message
Ionut Ciprian Costan is currently offline Ionut Ciprian CostanFriend
Messages: 5
Registered: March 2015
Junior Member
Hi,
I tried using StyledTextArea but I have some problems with it:
The enter key does not have any effect, does not create a newLine,
The cursor is still blinking in the component after I select another StyleTextArea component.
The focus is received only when I make a click on the first line in the component

Am I missing something?
I just do
StyledTextArea textField = new StyledTextArea();
textField.getContent().setText("");
//set some height constrains
textField.setMaxHeight(GridPane.USE_PREF_SIZE);
textField.setMinHeight(GridPane.USE_PREF_SIZE);
textField.setPrefHeight(100);

the component is put in a GridPane, and each row has a new component inside.

Thank you
Re: Text Widget highlight [message #1708625 is a reply to message #1708609] Fri, 18 September 2015 08:17 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

Could you try with a none empty text from the start - there's a bug when
the text is empty :-(

Tom

On 18.09.15 08:33, Ionut Ciprian Costan wrote:
> Hi,
> I tried using StyledTextArea but I have some problems with it:
> The enter key does not have any effect, does not create a newLine,
> The cursor is still blinking in the component after I select another
> StyleTextArea component. The focus is received only when I make a click
> on the first line in the component
>
> Am I missing something? I just do
> StyledTextArea textField = new StyledTextArea();
> textField.getContent().setText("");
> //set some height constrains
> textField.setMaxHeight(GridPane.USE_PREF_SIZE);
> textField.setMinHeight(GridPane.USE_PREF_SIZE);
> textField.setPrefHeight(100);
>
> the component is put in a GridPane, and each row has a new component
> inside.
>
> Thank you
Re: Text Widget highlight [message #1708627 is a reply to message #1708625] Fri, 18 September 2015 08:23 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
The bug is fixed with https://bugs.eclipse.org/bugs/show_bug.cgi?id=477772.

I can not reproduce the problem with newlines. What OS and what version
of Java are you running?

Tom

On 18.09.15 10:17, Tom Schindl wrote:
> Hi,
>
> Could you try with a none empty text from the start - there's a bug when
> the text is empty :-(
>
> Tom
>
> On 18.09.15 08:33, Ionut Ciprian Costan wrote:
>> Hi,
>> I tried using StyledTextArea but I have some problems with it:
>> The enter key does not have any effect, does not create a newLine,
>> The cursor is still blinking in the component after I select another
>> StyleTextArea component. The focus is received only when I make a click
>> on the first line in the component
>>
>> Am I missing something? I just do
>> StyledTextArea textField = new StyledTextArea();
>> textField.getContent().setText("");
>> //set some height constrains
>> textField.setMaxHeight(GridPane.USE_PREF_SIZE);
>> textField.setMinHeight(GridPane.USE_PREF_SIZE);
>> textField.setPrefHeight(100);
>>
>> the component is put in a GridPane, and each row has a new component
>> inside.
>>
>> Thank you
>
Re: Text Widget highlight [message #1708632 is a reply to message #1708609] Fri, 18 September 2015 08:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Cursor blinking has been fixed with
https://bugs.eclipse.org/bugs/show_bug.cgi?id=477773

Tom

On 18.09.15 08:33, Ionut Ciprian Costan wrote:
> Hi,
> I tried using StyledTextArea but I have some problems with it:
> The enter key does not have any effect, does not create a newLine,
> The cursor is still blinking in the component after I select another
> StyleTextArea component. The focus is received only when I make a click
> on the first line in the component
>
> Am I missing something? I just do
> StyledTextArea textField = new StyledTextArea();
> textField.getContent().setText("");
> //set some height constrains
> textField.setMaxHeight(GridPane.USE_PREF_SIZE);
> textField.setMinHeight(GridPane.USE_PREF_SIZE);
> textField.setPrefHeight(100);
>
> the component is put in a GridPane, and each row has a new component
> inside.
>
> Thank you
Re: Text Widget highlight [message #1708633 is a reply to message #1708627] Fri, 18 September 2015 08:50 Go to previous messageGo to next message
Ionut Ciprian Costan is currently offline Ionut Ciprian CostanFriend
Messages: 5
Registered: March 2015
Junior Member
Hi,
The problems persist even without an empty string at the beginning.

I'm using jre1.8.0_51 on Windows 7.

Regards,
Ionut

PS: maybe its important but my entire javafx component is wrapper in a FXCanvas, I am using javafx in a swt aplication.
Re: Text Widget highlight [message #1708634 is a reply to message #1708633] Fri, 18 September 2015 08:56 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
To rule that out can you try creating a simple JavaFX application (no
osgi involved) using it? I'll give it a try later on on my windows10 vm,
my dev env is OS-X.

Tom

On 18.09.15 10:50, Ionut Ciprian Costan wrote:
> Hi,
> The problems persist even without an empty string at the beginning.
>
> I'm using jre1.8.0_51 on Windows 7.
>
> Regards,
> Ionut
>
> PS: maybe its important but my entire javafx component is wrapper in a
> FXCanvas, I am using javafx in a swt aplication.
Re: Text Widget highlight [message #1708640 is a reply to message #1708634] Fri, 18 September 2015 09:46 Go to previous messageGo to next message
Ionut Ciprian Costan is currently offline Ionut Ciprian CostanFriend
Messages: 5
Registered: March 2015
Junior Member
Hi,
with a simple example, no OSGI involved, enter works

Regards,
Re: Text Widget highlight [message #1708645 is a reply to message #1708640] Fri, 18 September 2015 10:43 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
ok - need to investigate the FXCanvas stuff :-(

Tom

On 18.09.15 11:46, Ionut Ciprian Costan wrote:
> Hi,
> with a simple example, no OSGI involved, enter works
> Regards,
>
Re: Text Widget highlight [message #1709892 is a reply to message #1708645] Thu, 01 October 2015 18:13 Go to previous messageGo to next message
Stefan Häusler is currently offline Stefan HäuslerFriend
Messages: 23
Registered: May 2013
Junior Member
Hello Tom,

did you already had the time to investigate this further and have some news here?

Thank you very much in advance,
Stefan

[Updated on: Fri, 02 October 2015 09:40]

Report message to a moderator

Re: Text Widget highlight [message #1709916 is a reply to message #1709892] Thu, 01 October 2015 21:41 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

I looked into it for the last hour, identified the problem and fixed it
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=478857

Tom

On 01.10.15 20:13, Stefan Häusler wrote:
> Hello Tom,
>
> did you already had the team to investigate this further and have some
> news here?
>
> Thank you very much in advance,
> Stefan
Re: Text Widget highlight [message #1709965 is a reply to message #1709916] Fri, 02 October 2015 09:42 Go to previous messageGo to next message
Stefan Häusler is currently offline Stefan HäuslerFriend
Messages: 23
Registered: May 2013
Junior Member
Hello Tom,

thank you very much for the quick answer.

I investigated a little bit further, we searched for the possibility to highlight text with a squiggle underline (use case is to highlight syntax errors).

It seems that such kind of underline is foreseen to be supported in your widget but not implemented in the styled text renderer (maybe due to a limitation in JavaFX?).

Is this understanding correct?

Best regards,
Stefan

[Updated on: Fri, 02 October 2015 09:42]

Report message to a moderator

Re: Text Widget highlight [message #1709972 is a reply to message #1709965] Fri, 02 October 2015 10:22 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
The StyledTextArea does support underlineing

..underlinedText {
-efx-decoration: underline;
}

..underlinedText > Line {
-fx-stroke: red;
}

We currently only have a very simple default strategy available (see
UnderlineStrategyFactory) but you can contribute your own (for fun we
internally once wrote a fire-underline which really looks cool on dark
backgrounds).

Caveat: The current annotation stuff from the text-infrastructure does
not use that support

Tom

On 02.10.15 11:42, Stefan Häusler wrote:
> Hello Tom,
>
> thank you very much for the quick answer.
>
> I investigated a little bit further, we searched for the possibility to
> highlight text with a squiggle underline (use case is to highlight
> syntax errors).
>
> Unfortunately, it seems that such kind of underline is forseen to be
> supported but not implemented in the styled text renderer (maybe due to
> a limitation in JavaFX).
> Is this understanding correct?
>
> Best regards,
> Stefan
Re: Text Widget highlight [message #1720136 is a reply to message #1709972] Thu, 14 January 2016 16:18 Go to previous messageGo to next message
Andy Armaignac is currently offline Andy ArmaignacFriend
Messages: 6
Registered: February 2015
Junior Member
Hi tom it's possible to wrapText in StyledTextArea..??

[Updated on: Thu, 14 January 2016 16:23]

Report message to a moderator

Re: Text Widget highlight [message #1720153 is a reply to message #1720136] Thu, 14 January 2016 18:35 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
No - we don't have wrapping support yet!

Tom

On 14.01.16 17:18, Andy Armaignac wrote:
> Hi tom it's possible to create wrapText in StyledTextArea..??
Previous Topic:Code editor repo
Next Topic:tycho build failing due to missing efxclipse dependencies
Goto Forum:
  


Current Time: Fri Apr 19 11:39:14 GMT 2024

Powered by FUDForum. Page generated in 0.02773 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top