Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. // Inserter.java
  2. @FunctionalInterface
  3. public interface Inserter extends EventHandler<ActionEvent> {
  4.  
  5. public abstract void handle(ActionEvent e);
  6.  
  7. default void insert(parameters...) {
  8. ...inserting stuff to db
  9. }
  10. }
  11.  
  12. // Other.java: insert stuff to db on button click
  13.  
  14. // This works normally
  15.  
  16. button.setOnAction(new Inserter() {
  17. @Override
  18. public void handle(ActionEvent e) {
  19. insert(parameters...);
  20. }
  21. }
  22. );
  23.  
  24. // Possible to implement it this way? Cannot find symbol "insert"
  25. button.setOnAction(
  26. (e) -> insert(parameters...)
  27. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement