changeset 7978:3f25a032f503

RT-36577: Restore missing comments that were lost in lambda conversion
author kcr
date Thu, 04 Sep 2014 09:38:18 -0700
parents e43736c57ec8
children e57c43d3e16f
files apps/samples/Ensemble8/src/app/java/ensemble/EnsembleApp.java apps/samples/Ensemble8/src/app/java/ensemble/HomePage.java apps/samples/Ensemble8/src/app/java/ensemble/control/Popover.java apps/samples/Ensemble8/src/app/java/ensemble/samplepage/XYDataVisualizer.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/animation/timeline/TimelineApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/line/stock/StockLineChartApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/scrollbar/ScrollBarApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/brickbreaker/Level.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/language/changelistener/ChangeListenerApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/language/observablelist/ObservableListApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/media/advancedmedia/MediaControl.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/advancedstage/AdvancedStageApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/gestureevent/GestureEventApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/keystrokemotion/LettersPane.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/mouseevent/MouseEventApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/multitouch/MultiTouchImageView.java apps/toys/Hello/src/main/java/hello/FloodGame.java apps/toys/Hello/src/main/java/hello/HelloTableView.java modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java modules/graphics/src/main/java/com/sun/glass/ui/gtk/GtkApplication.java modules/graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java modules/graphics/src/main/java/com/sun/glass/ui/win/WinApplication.java modules/graphics/src/main/java/com/sun/javafx/application/LauncherImpl.java modules/graphics/src/main/java/com/sun/javafx/application/PlatformImpl.java modules/graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java modules/graphics/src/main/java/javafx/concurrent/Service.java tests/system/src/test/java/javafx/stage/ShowAndWaitTest.java
diffstat 28 files changed, 97 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/apps/samples/Ensemble8/src/app/java/ensemble/EnsembleApp.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/app/java/ensemble/EnsembleApp.java	Thu Sep 04 09:38:18 2014 -0700
@@ -321,6 +321,7 @@
                     bufferedReader.readLine();
                 }
                 Platform.runLater(() -> {
+                    // when succeeded add this stylesheet to the scene
                     scene.getStylesheets().add(EXTERNAL_STYLESHEET);
                 });
             }catch (MalformedURLException ex) {
--- a/apps/samples/Ensemble8/src/app/java/ensemble/HomePage.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/app/java/ensemble/HomePage.java	Thu Sep 04 09:38:18 2014 -0700
@@ -298,6 +298,7 @@
             sampleButton.setGraphic(Samples.HIGHLIGHTS[highlightIndex].getLargePreview());
             sampleButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
             sampleButton.setOnAction((ActionEvent actionEvent) -> {
+//                System.out.println("Clicked " + Samples.HIGHLIGHTS[highlightIndex].name);
                 pageBrowser.goToSample(Samples.HIGHLIGHTS[highlightIndex]);
             });
             return sampleButton;
--- a/apps/samples/Ensemble8/src/app/java/ensemble/control/Popover.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/app/java/ensemble/control/Popover.java	Thu Sep 04 09:38:18 2014 -0700
@@ -128,6 +128,7 @@
         setScaleY(.8);
         // create handlers for auto hiding
         popoverHideHandler = (MouseEvent t) -> {
+            // check if event is outside popup
             Point2D mouseInFilterPane = sceneToLocal(t.getX(), t.getY());
             if (mouseInFilterPane.getX() < 0 || mouseInFilterPane.getX() > (getWidth()) ||
                     mouseInFilterPane.getY() < 0 || mouseInFilterPane.getY() > (getHeight())) {
--- a/apps/samples/Ensemble8/src/app/java/ensemble/samplepage/XYDataVisualizer.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/app/java/ensemble/samplepage/XYDataVisualizer.java	Thu Sep 04 09:38:18 2014 -0700
@@ -274,6 +274,7 @@
         removeAllDataMenuItem.setDisable(!isEditable());
         removeAllDataMenuItem.setOnAction((ActionEvent t) -> {
             chart.getData().clear();
+//            chart.setData(null);
         });
 
         MenuItem setNewDataMenuItem = new MenuItem("Set new data");
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/animation/timeline/TimelineApp.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/animation/timeline/TimelineApp.java	Thu Sep 04 09:38:18 2014 -0700
@@ -108,18 +108,22 @@
         //start/stop/pause/play from start buttons
         Button buttonStart = new Button("Start");
         buttonStart.setOnAction((ActionEvent t) -> {
+            //start timeline
             timeline.play();
         });
         Button buttonStop = new Button("Stop");
         buttonStop.setOnAction((ActionEvent t) -> {
+            //stop timeline
             timeline.stop();
         });
         Button buttonPlayFromStart = new Button("Restart");
         buttonPlayFromStart.setOnAction((ActionEvent t) -> {
+            //play from start
             timeline.playFromStart();
         });
         Button buttonPause = new Button("Pause");
         buttonPause.setOnAction((ActionEvent t) -> {
+            //pause from start
             timeline.pause();
         });
         //text showing current time
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/line/stock/StockLineChartApp.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/line/stock/StockLineChartApp.java	Thu Sep 04 09:38:18 2014 -0700
@@ -74,6 +74,7 @@
         animation = new Timeline();
         animation.getKeyFrames()
                 .add(new KeyFrame(Duration.millis(1000 / 60), (ActionEvent actionEvent) -> {
+                     // 6 minutes data per frame
                     for (int count = 0; count < 6; count++) {
                         nextTime();
                         plotTime();
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/scrollbar/ScrollBarApp.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/scrollbar/ScrollBarApp.java	Thu Sep 04 09:38:18 2014 -0700
@@ -79,6 +79,7 @@
         xscrollBar = horizontalScrollBar(-1,-1,xBarWidth,xBarHeight,xBarWidth,xBarHeight);
         xscrollBar.setUnitIncrement(20.0);
         xscrollBar.valueProperty().addListener((ObservableValue<? extends Number> observable, Number oldValue, Number newValue) -> {
+            //changes the x position of the circle
             setScrollValueX(xscrollBar.getValue(), circle);
         });
 
@@ -86,6 +87,7 @@
         yscrollBar = verticalScrollBar(-1,-1,yBarWidth,yBarHeight,yBarWidth,yBarHeight);
         yscrollBar.setUnitIncrement(20.0);
         yscrollBar.valueProperty().addListener((ObservableValue<? extends Number> observable, Number oldValue, Number newValue) -> {
+            //changes the y position of the circle
             setScrollValueY(yscrollBar.getValue(), circle);
         });
 
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/brickbreaker/Level.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/brickbreaker/Level.java	Thu Sep 04 09:38:18 2014 -0700
@@ -606,6 +606,7 @@
             me.consume();
         });
         background.setOnMouseDragged((MouseEvent me) -> {
+            // Support touch-only devices like some mobile phones
             moveBat(me.getX() - bat.getWidth() / 2);
             me.consume();
         });
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/language/changelistener/ChangeListenerApp.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/language/changelistener/ChangeListenerApp.java	Thu Sep 04 09:38:18 2014 -0700
@@ -97,6 +97,7 @@
         Button buttonAdd = new Button("Add listener");
         buttonAdd.setPrefSize(140, 18);
         buttonAdd.setOnAction((ActionEvent t) -> {
+            //add the listener on property hover
             rect.hoverProperty().addListener(hoverListener);
             text.setText("listener added");
         });
@@ -104,6 +105,7 @@
         Button buttonRemove = new Button("Remove listener");
         buttonRemove.setPrefSize(140, 18);
         buttonRemove.setOnAction((ActionEvent t) -> {
+            //remove the listener
             rect.hoverProperty().removeListener(hoverListener);
             text.setText("listener removed");
         });
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/language/observablelist/ObservableListApp.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/language/observablelist/ObservableListApp.java	Thu Sep 04 09:38:18 2014 -0700
@@ -116,6 +116,7 @@
         Button buttonRemove = new Button("Remove list listener");
         buttonRemove.setPrefSize(190, 45);
         buttonRemove.setOnAction((ActionEvent t) -> {
+            //remove the listener
             list.removeListener(listener);
             textMessage.setText("listener removed");
         });
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/media/advancedmedia/MediaControl.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/media/advancedmedia/MediaControl.java	Thu Sep 04 09:38:18 2014 -0700
@@ -178,6 +178,7 @@
         });
         mp.setOnPaused(() -> {
             playButton.setGraphic(imageViewPlay);
+            //playButton.setText("||");
         });
         mp.setOnReady(() -> {
             duration = mp.getMedia().getDuration();
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/advancedstage/AdvancedStageApp.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/advancedstage/AdvancedStageApp.java	Thu Sep 04 09:38:18 2014 -0700
@@ -80,43 +80,77 @@
         button.setStyle("-fx-font-size: 24;");
         button.setDefaultButton(true);
         button.setOnAction((ActionEvent t) -> {
+            // INITIALISATION OF THE STAGE/SCENE
+
+            //create stage which has set stage style transparent
             final Stage stage = new Stage(StageStyle.TRANSPARENT);
+
+            //create root node of scene, i.e. group
             Group rootGroup = new Group();
+
+            //create scene with set width, height and color
             Scene scene = new Scene(rootGroup, 200, 200, Color.TRANSPARENT);
+
+            //set scene to stage
             stage.setScene(scene);
+
+            //center stage on screen
             stage.centerOnScreen();
+
+            //show the stage
             stage.show();
+
+            // CREATION OF THE DRAGGER (CIRCLE)
+
+            //create dragger with desired size
             Circle dragger = new Circle(100, 100, 100);
+
+            //fill the dragger with some nice radial background
             dragger.setFill(new RadialGradient(-0.3, 135, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[]{
                 new Stop(0, Color.DARKGRAY),
                 new Stop(1, Color.BLACK)
             }));
+
+            //when mouse button is pressed, save the initial position of screen
             rootGroup.setOnMousePressed((MouseEvent me) -> {
                 initX = me.getScreenX() - stage.getX();
                 initY = me.getScreenY() - stage.getY();
             });
+
+            //when screen is dragged, translate it accordingly
             rootGroup.setOnMouseDragged((MouseEvent me) -> {
                 stage.setX(me.getScreenX() - initX);
                 stage.setY(me.getScreenY() - initY);
             });
+
+            // CREATE MIN AND CLOSE BUTTONS
+            //create button for closing application
             Button close = new Button("Close me");
             close.setOnAction((ActionEvent event) -> {
                 stage.close();
             });
+
+            //create button for minimalising application
             Button min = new Button("Minimize me");
             min.setOnAction((ActionEvent event) -> {
                 stage.setIconified(true);
             });
-            Text text = new Text("JavaFX");
+
+            // CREATE SIMPLE TEXT NODE
+            Text text = new Text("JavaFX"); //20, 110,
             text.setFill(Color.WHITESMOKE);
             text.setEffect(new Lighting());
             text.setBoundsType(TextBoundsType.VISUAL);
             text.setFont(Font.font(Font.getDefault().getFamily(), 50));
+
+            // USE A LAYOUT VBOX FOR EASIER POSITIONING OF THE VISUAL NODES ON SCENE
             VBox vBox = new VBox();
             vBox.setSpacing(10);
             vBox.setPadding(new Insets(60, 0, 0, 20));
             vBox.setAlignment(Pos.TOP_CENTER);
             vBox.getChildren().addAll(text, min, close);
+
+            //add all nodes to main root group
             rootGroup.getChildren().addAll(dragger, vBox);
         });
         return button;
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/gestureevent/GestureEventApp.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/gestureevent/GestureEventApp.java	Thu Sep 04 09:38:18 2014 -0700
@@ -194,6 +194,7 @@
         });
 
         listeningNode.setOnScroll((ScrollEvent event) -> {
+            // scroll amount
             double translateX = event.getDeltaX();
             double translateY = event.getDeltaY();
             
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/keystrokemotion/LettersPane.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/keystrokemotion/LettersPane.java	Thu Sep 04 09:38:18 2014 -0700
@@ -99,6 +99,7 @@
         final Timeline timeline = new Timeline();
         timeline.getKeyFrames().add(
                 new KeyFrame(Duration.seconds(3), (ActionEvent event) -> {
+                    // we are done remove us from scene
                     getChildren().remove(letter);
         },
                 new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()), INTERPOLATOR),
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/mouseevent/MouseEventApp.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/mouseevent/MouseEventApp.java	Thu Sep 04 09:38:18 2014 -0700
@@ -107,6 +107,7 @@
         circleBig.setTranslateY(BIG_CIRCLE_STARTY);
         // we can set mouse event to any node, also on the rectangle
         rectangle.setOnMouseMoved((MouseEvent me) -> {
+            //log mouse move to console, method listed below
             showOnConsole("Mouse moved, x: " + me.getX() + ", y: " + me.getY());
         });
 
@@ -172,6 +173,7 @@
             showOnConsole(name + " was dragged (x:" + dragX + ", y:" + dragY + ")");
         });
         circle.setOnMouseEntered((MouseEvent me) -> {
+            //change the z-coordinate of the circle
             circle.toFront();
             showOnConsole("Mouse entered " + name);
         });
@@ -179,6 +181,7 @@
             showOnConsole("Mouse exited " + name);
         });
         circle.setOnMousePressed((MouseEvent me) -> {
+            //when mouse is pressed, store initial position
             initX = circle.getTranslateX();
             initY = circle.getTranslateY();
             dragAnchor = new Point2D(me.getSceneX(), me.getSceneY());
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/multitouch/MultiTouchImageView.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/scenegraph/events/multitouch/MultiTouchImageView.java	Thu Sep 04 09:38:18 2014 -0700
@@ -58,6 +58,7 @@
             lastX = event.getX();
             lastY = event.getY();
             toFront();
+            //  postView.toFront();
         });
         setOnMouseDragged((MouseEvent event) -> {
             double layoutX = getLayoutX() + (event.getX() - lastX);
--- a/apps/toys/Hello/src/main/java/hello/FloodGame.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/toys/Hello/src/main/java/hello/FloodGame.java	Thu Sep 04 09:38:18 2014 -0700
@@ -125,6 +125,7 @@
             fadeOut.setFromValue(1);
             fadeOut.setToValue(0);
             fadeOut.setInterpolator(Interpolator.EASE_OUT);
+            // setFill
             fadeOut.setOnFinished( event -> cellf.setFill(newColor));
 
             // fade in
@@ -133,6 +134,8 @@
             fadeIn.setToValue(1);
             fadeIn.setInterpolator(Interpolator.EASE_OUT);
             fadeIn.setOnFinished(event -> {
+                // TODO not the best place to put the win check, since
+                // this gets called once for EVERY cell that's changing color
                 if (gameWon()) {
                     doneLabel.setText("YOU WON!!");
                 } else {
--- a/apps/toys/Hello/src/main/java/hello/HelloTableView.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/apps/toys/Hello/src/main/java/hello/HelloTableView.java	Thu Sep 04 09:38:18 2014 -0700
@@ -299,7 +299,16 @@
         firstNameCol.setSortNode(sortNode);
 //        firstNameCol.setCellFactory(TextFieldCellFactory.tableView());
         firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName"));
-        firstNameCol.setOnEditCommit(t -> System.out.println("Edit commit event: " + t.getNewValue()));
+        firstNameCol.setOnEditCommit(t -> {
+            System.out.println("Edit commit event: " + t.getNewValue());
+//            Object obj = t.getNewValue();
+//
+//            if (obj instanceof String) {
+//                ListView lv = t.getSource();
+//                lv.getItems().remove((int) lv.getEditingIndex());
+//                lv.getItems().add( (int) lv.getEditingIndex(), obj);
+//            }
+        });
 
         TableColumn<Person, String> lastNameCol = new TableColumn<>();
         lastNameCol.setText("Last");
@@ -454,7 +463,10 @@
         GridPane.setConstraints(insertBtn, 1, 9);
 
         final Button renameEthanBtn = new Button("Rename Ethan");
-        renameEthanBtn.setOnAction(t -> data.get(2).setFirstName(new BigInteger(40, new Random()).toString(32)));
+        renameEthanBtn.setOnAction(t -> {
+            data.get(2).setFirstName(new BigInteger(40, new Random()).toString(32));
+            // data.set(2, new Person("Jonathan", "Giles"));
+        });
         grid.getChildren().add(renameEthanBtn);
         GridPane.setConstraints(renameEthanBtn, 1, 10);
 
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Thu Sep 04 09:38:18 2014 -0700
@@ -452,6 +452,7 @@
         ** In a ScrollPane a vertical scroll should scroll on the vertical only,
         ** whereas in a horizontal ScrollBar it can scroll horizontally.
         */ 
+        // block the event from being passed down to children
         final EventDispatcher blockEventDispatcher = (event, tail) -> event;
         // block ScrollEvent from being passed down to scrollbar's skin
         final EventDispatcher oldHsbEventDispatcher = hsb.getEventDispatcher();
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Thu Sep 04 09:38:18 2014 -0700
@@ -499,6 +499,7 @@
         ** In a VirtualFlow a vertical scroll should scroll on the vertical only,
         ** whereas in a horizontal ScrollBar it can scroll horizontally.
         */ 
+        // block the event from being passed down to children
         final EventDispatcher blockEventDispatcher = (event, tail) -> event;
         // block ScrollEvent from being passed down to scrollbar's skin
         final EventDispatcher oldHsbEventDispatcher = hbar.getEventDispatcher();
--- a/modules/graphics/src/main/java/com/sun/glass/ui/gtk/GtkApplication.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/gtk/GtkApplication.java	Thu Sep 04 09:38:18 2014 -0700
@@ -68,6 +68,7 @@
             throw new UnsupportedOperationException("Unable to open DISPLAY");
         }
 
+        // Embedded in SWT, with shared event thread
         boolean isEventThread = AccessController
                 .doPrivileged((PrivilegedAction<Boolean>) () -> Boolean.getBoolean("javafx.embed.isEventThread"));
         if (!isEventThread) {
@@ -118,6 +119,7 @@
 
     @Override
     protected void runLoop(final Runnable launchable) {
+        // Embedded in SWT, with shared event thread
         final boolean isEventThread = AccessController
             .doPrivileged((PrivilegedAction<Boolean>) () -> Boolean.getBoolean("javafx.embed.isEventThread"));
         
--- a/modules/graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java	Thu Sep 04 09:38:18 2014 -0700
@@ -56,6 +56,7 @@
     private final InvokeLaterDispatcher invokeLaterDispatcher;
 
     MacApplication() {
+        // Embedded in SWT, with shared event thread
         boolean isEventThread = AccessController
                 .doPrivileged((PrivilegedAction<Boolean>) () -> Boolean.getBoolean("javafx.embed.isEventThread"));
         if (!isEventThread) {
--- a/modules/graphics/src/main/java/com/sun/glass/ui/win/WinApplication.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/win/WinApplication.java	Thu Sep 04 09:38:18 2014 -0700
@@ -62,6 +62,7 @@
 
     private final InvokeLaterDispatcher invokeLaterDispatcher;
     WinApplication() {
+        // Embedded in SWT, with shared event thread
         boolean isEventThread = AccessController
                 .doPrivileged((PrivilegedAction<Boolean>) () -> Boolean.getBoolean("javafx.embed.isEventThread"));
         if (!isEventThread) {
--- a/modules/graphics/src/main/java/com/sun/javafx/application/LauncherImpl.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/modules/graphics/src/main/java/com/sun/javafx/application/LauncherImpl.java	Thu Sep 04 09:38:18 2014 -0700
@@ -646,6 +646,8 @@
         }
 
         final CountDownLatch startupLatch = new CountDownLatch(1);
+
+        // Note, this method is called on the FX Application Thread
         PlatformImpl.startup(() -> startupLatch.countDown());
 
         // Wait for FX platform to start
--- a/modules/graphics/src/main/java/com/sun/javafx/application/PlatformImpl.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/modules/graphics/src/main/java/com/sun/javafx/application/PlatformImpl.java	Thu Sep 04 09:38:18 2014 -0700
@@ -445,7 +445,10 @@
         if (initialized.get()) {
             // Always call toolkit exit on FX app thread
 //            System.err.println("PlatformImpl.tkExit: scheduling Toolkit.exit");
-            PlatformImpl.runAndWait(() -> Toolkit.getToolkit().exit(), true);
+            PlatformImpl.runAndWait(() -> {
+//                System.err.println("PlatformImpl.tkExit: calling Toolkit.exit");
+                Toolkit.getToolkit().exit();
+            }, true);
 
             if (isThreadMerged) {
                 removeFwEventQueue();
--- a/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java	Thu Sep 04 09:38:18 2014 -0700
@@ -253,6 +253,7 @@
         try {
             this.userRunnable = userStartupRunnable;
 
+            // Ensure that the toolkit can only be started here
             Application.run(() -> runToolkit());
         } catch (RuntimeException ex) {
             if (verbose) {
--- a/modules/graphics/src/main/java/javafx/concurrent/Service.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/modules/graphics/src/main/java/javafx/concurrent/Service.java	Thu Sep 04 09:38:18 2014 -0700
@@ -171,7 +171,8 @@
             LOG.warning("Uncaught throwable in " + THREAD_GROUP.getName(), throwable);
         }
     };
-    
+
+    // Addition of doPrivileged added due to RT-19580
     private static final ThreadFactory THREAD_FACTORY = run -> AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
         final Thread th = new Thread(THREAD_GROUP, run);
         th.setUncaughtExceptionHandler(UNCAUGHT_HANDLER);
--- a/tests/system/src/test/java/javafx/stage/ShowAndWaitTest.java	Thu Sep 04 18:29:31 2014 +0200
+++ b/tests/system/src/test/java/javafx/stage/ShowAndWaitTest.java	Thu Sep 04 09:38:18 2014 -0700
@@ -334,7 +334,10 @@
             assertFalse(stage1ShowReturned.get());
         };
 
-        Runnable rNext = () -> nextRunnableReached.set(true);
+        Runnable rNext = () -> {
+            // This should happen after the nested event loop exits
+            nextRunnableReached.set(true);
+        };
 
         Util.runAndWait(rShow1, rHide1, rNext);
 
@@ -373,7 +376,10 @@
             tmpStage1.hide();
             Util.sleep(1);
             assertFalse(stage1ShowReturned.get());
-            Platform.runLater(() -> nextRunnableReached.set(true));
+            Platform.runLater(() -> {
+                // This should happen after the nested event loop exits
+                nextRunnableReached.set(true);
+            });
         };
 
         Util.runAndWait(rShow1, rHide1);