changeset 6072:399f574b5ab8

HelloSanity: print out when any action is invoked in a menu
author snorthov
date Fri, 10 Jan 2014 15:05:56 -0500
parents 838ab16784b0
children 6216d402dc1b 46d16b777197
files apps/toys/Hello/src/main/java/hello/TestBuilder.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/apps/toys/Hello/src/main/java/hello/TestBuilder.java	Mon Jan 13 14:27:07 2014 +0100
+++ b/apps/toys/Hello/src/main/java/hello/TestBuilder.java	Fri Jan 10 15:05:56 2014 -0500
@@ -324,7 +324,7 @@
 
         final MenuBar menuBar = new MenuBar();
         final String os = System.getProperty("os.name");
-        EventHandler actionHandler = new EventHandler<ActionEvent>() {
+        final EventHandler actionHandler = new EventHandler<ActionEvent>() {
             public void handle(ActionEvent t) {
                 if (t.getTarget() instanceof MenuItem) {
                     System.out.println(((MenuItem)t.getTarget()).
@@ -348,6 +348,7 @@
         MenuItem menu15 = new MenuItem("E_xit");
         menu15.setOnAction(new EventHandler<ActionEvent>() {
             public void handle(ActionEvent t) {
+                actionHandler.handle(t);
                 System.exit(0);
             }
         });
@@ -357,6 +358,7 @@
         menu16.setAccelerator(KeyCombination.keyCombination("Shortcut+C"));
         menu16.setOnAction(new EventHandler<ActionEvent>() {
             public void handle(ActionEvent t) {
+                actionHandler.handle(t);
                 menu16.setText((menu16.getText().equals(
                                     change[0])) ? change[1] : change[0]);
             }