Notepad with JavaFX

0

Good afternoon!

I'm a beginner in the Java universe, and I'm doing a notepad in JavaFX, basing myself on the standard Windows notepad, in order to fix the learning. I am using in place of a TextArea a javafx.scene.web.HTMLEditor to have a greater freedom of formatting without using external API. However, there are two features that I have no idea how to do:

  • Status bar (menu "view -> status bar" in the notepad of the Windows), it displays the line and column where the user is typing My question is: how to get the position of the cursor to be able to put it in a label via setText ()? I already had the idea to use a loop to count the "\ n" in the text to get the line, and get the lenght of a line to pick up the column. This does not change the position of the cursor with the mouse or the arrow keys on the keyboard. line and column values would not be updated.
  • Find string (menu "edit - > Find ..." in notepad Windows), it displays a screen that looks in the text that the user typed in an information he wants, and selects that information. I know how to do the search engine through the Pattern classes and Matcher, but how do you select the occurrences found in the text?
  • I've spent a lot of time searching Google, forums and even javadoc, but I was not successful. Thanks for helping.

        
    asked by anonymous 25.07.2018 / 18:57

    0 answers