title: MouseEvent -- Add Circles To Scene
body: <p>The program involves the application of EventHandlers and MouseEvents. The goal of this program is to present a blank scene that the user can left click (primary) and add a circle object to the scene where the mouse is located at the time of the event. The number of circles that can be added does not matter. When the user right clicks (secondary) the mouse while hovering over a target node (circle object), the object will be removed from the scene. The program I have written so far will display a circle, but only at the origin of the scene and not where the mouse was located. Also, I am only able to add one circle to the scene and no others, if I click the primary again, I am unable to click the secondary and remove the circle located at the origin. </p>
  
  <pre><code>   static Circle circle;    
  
  @Override
  public void start(Stage primaryStage) {
      StackPane root = new StackPane();
      Scene scene = new Scene(root, 350, 300);
      primaryStage.setTitle("Dots");
      primaryStage.setScene(scene);
  
      root.addEventHandler(MouseEvent.MOUSE_CLICKED, (MouseEvent me) -&gt; {
          if(me.getButton().equals(MouseButton.PRIMARY)) {
              root.getChildren().add(new Circle(me.getScreenX(), me.getScreenY(), 10, Color.BLUE));
          }
      });
  
      root.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, (MouseEvent me) -&gt; {
          if(me.getButton().equals(MouseButton.SECONDARY)) {
              root.getChildren().remove(me.getTarget());
          }
      });
  
      primaryStage.show();
  }
  </code></pre>
  
  <p>I don't believe that using two event handlers is the best way to accomplish this. Originally, I had the second event handler body  (root.getChildren) within an if else statement in the first handler. The reason I changed it was because I wasn't sure how to implement MouseEvent.MOUSE_ENTERED_TARGET to specify which circle object to remove from the scene. </p>