title: Reading Special MouseButtons
body: <p>I am interested in capturing input from the explorer mouse buttons (the special buttons on the side of mice normally used to go forward and back on web browsers).</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.scene.Scene;
  import javafx.scene.layout.Pane;
  import javafx.stage.Stage;
  import javafx.scene.input.MouseButton;
  import static java.lang.System.*;
  
  public class MouseThing extends Application
  {
      @Override
      public void start(Stage stage) throws Exception
      {
          Pane pane = new Pane();
  
          pane.setOnMousePressed(e -&gt; {
              if(e.getButton() == MouseButton.PRIMARY)
                  out.println("LEFT"); 
              if(e.getButton() == MouseButton.SECONDARY)
                  out.println("RIGHT");      
              if(e.getButton() == MouseButton.MIDDLE)
                  out.println("MIDDLE");    
              if(e.getButton() == MouseButton.NONE)
                  out.println("OTHER");  
              // How read explorer buttons?  
              out.println("click");
          });
  
          Scene scene = new Scene(pane, 300, 100);
          stage.setTitle("Demo");
          stage.setScene(scene);
          stage.show();
      }
  }
  </code></pre>
  
  <p>Just for the example, I would like to record that the advance and retreat buttons were activated.  The only interaction I can achieve at this point is left, right and middle clicks.  Pressing the <code>forward</code> and <code>back</code> buttons on the mouse doesn't even register the <code>click</code> print.</p>
  
  <p>There was this post for Javascript: <a href="https://stackoverflow.com/questions/7906619/js-special-mouse-buttons">JS special mouse buttons</a>, but it wasn't useful for my purposes.</p>