• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaFX get current line of text area?

 
Marcus Fernstrom
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to figure out how to get the current line number, and how to check the number of characters on that line.

I'm using a simple TextArea (JavaFx).

I've been looking around but not finding any solutions.
 
Paul Clapham
Sheriff
Posts: 21551
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TextArea? You're better off using a JTextArea, which has methods like getLineOfOffset(offset) to handle that sort of thing.
 
Maneesh Godbole
Saloon Keeper
Posts: 11312
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:TextArea? You're better off using a JTextArea, which has methods like getLineOfOffset(offset) to handle that sort of thing.

I think the OP is referring to https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TextArea.html

Moving to a more appropriate forum...
 
John Damien Smith
Ranch Hand
Posts: 296
14
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JavaFX TextArea has no public API to support the concept of a current line number of the number of characters on a line.
I suggest you consider an alternate text editing control API such as RichTextFX (which may provide the features you require - I'm not sure as I have not used it in detail). If RichTextFX does not provide the APIs you require, then you could make a feature request to the RichTextFX developer to implement the features you need.
 
Marcus Fernstrom
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RichTextFX seems to be what I need, now to figure out how to use it (New to Java), thanks John

I had no idea there was a JavaFX area, I saw the "GUI Stuff" text and posted there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic