Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- patternList.setCellFactory(TextFieldListCell.forListView(new StringConverter<Pattern>() {
- @Override
- public String toString(Pattern pattern) {
- return pattern.toString();
- }
- @Override
- public Pattern fromString(String string) {
- try {
- return Pattern.compile(string);
- } catch (PatternSyntaxException e) {
- return null;
- }
- }
- }));
- patternList.setOnEditCommit(e -> {
- if (e.getNewValue() == null) {
- // TODO pattern syntax error, prevent commit and stay in edit mode
- } else {
- patternList.getItems().set(e.getIndex(), e.getNewValue());
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement