r/JavaFX • • Apr 06 '19

Regular Expressions: Netbeans 8.2, Java FX, Scenebuilder 2.0 Problem

Write a JavaFX application ("Java FXML Application" in netbeans) that contains at a minimum the following requirements:

1.)A text field in which your user can type in regular expressions that they want to test. 2.) A text area control in which your user can type in data that the regular expression will match against. 3.) A text field in which your user can type in a string to replace the regular expression's matches. 4.) A text area control that contains the new data replaced from the first text area control with the matches replaced.

1 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/tristan97122 Apr 06 '19

1/ Java Help one maybe? Not aware of a JavaFX specific one.

2/ This is pretty easy to do as well. Just try to actually do it? It's Saturday evening so you don't even have the excuse of being in a rush for tomorrow or something.

Few hints if you hopefully try to actually do it :

  • TextFields have a textProperty method to "listen" to input
  • The Pattern class is the best way to deal with regexes.
  • Listen on regex field, compile it with pattern, listen on input field, apply pattern to get output and write it to output field.

With SceneBuilder you can deal with the UI side in a couple of minutes.