Source of HandleButtonClick.java


  1: import javafx.event.ActionEvent;
  2: import javafx.event.EventHandler;
  3: 
  4: /**
  5: This class handles a button click and outputs a message.
  6: The handle method is invoked when the button is clicked.
  7: */
  8: public class HandleButtonClick implements EventHandler<ActionEvent>
  9: {
 10:         private String message;
 11:         public HandleButtonClick()
 12:         {
 13:                 message = "It is sunny!";
 14:         }
 15:         public HandleButtonClick(String customMessage)
 16:         {
 17:                 message = customMessage;
 18:         }
 19:         @Override
 20:         public void handle(ActionEvent event)
 21:         {
 22:         System.out.println(message);
 23:     }
 24: }
 25: