Exemplo n.º 1
0
    @Override
    public void handle(final ActionEvent event) {
      final MenuItem menuItem = (MenuItem) event.getSource();

      Application.setUserAgentStylesheet(menuItem.getUserData().toString());

      preferences.put(LAST, menuItem.getUserData().toString());

      final String current = preferences.get(LAST, null);

      if (current != null && !current.equals(menuItem.getUserData().toString())) {
        Application.setUserAgentStylesheet(menuItem.getUserData().toString());
      }
    }
Exemplo n.º 2
0
 public static void main(String[] args) {
   try {
     Application.launch(GUI.class, args);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 @Override
 public void stop() throws Exception {
   PropertyTimer.stopWork();
   if (lines != null) lines.stream().forEach(line -> line.destroy());
   MessageSystemManager.destroy();
   super.stop();
 }
 public static void main(String[] args) throws Exception {
   DefaultInMemoryConfig config = new DefaultInMemoryConfig();
   config.registerDefaultActions();
   config.getClientDolphin().getClientConnector().setUiThreadHandler(new JavaFXUiThreadHandler());
   registerApplicationActions(config);
   javafx.application.Application.launch(solrTest.Main.class);
 }
  public static void main(String[] args) {
    // Check folder consistency
    FolderFileManager.checkFolders();

    // Download latest info from Dropbox and load the data to RAM
    Manager.INSTANCE.downloadData();
    // IMPORTANT: loadData is called after downloading the data and extracting it
    // If the data fetch fails, loadData is called (in the catch of the try catch part of
    // downloadData)
    // Manager.INSTANCE.loadData();

    Runtime.getRuntime()
        .addShutdownHook(
            new Thread(
                new Runnable() {
                  @Override
                  public void run() {
                    // Save all data from RAM and upload it to Dropbox. saveData calls uploadData
                    Manager.INSTANCE.saveData();
                  }
                }));

    // ----- Delete any test code from this line -----

    // ----- To this line -----

    Application.launch(Main.class, args);
  }
 @Override
 public void stop() throws Exception {
   super.stop();
   if (stopCallback != null) {
     stopCallback.call();
   }
 }
Exemplo n.º 7
0
  @Override
  public void stop() throws Exception {
    if (appContext != null) {
      appContext.close();
    }

    super.stop();
  }
Exemplo n.º 8
0
  @Override
  public void init() throws Exception {
    super.init(); // To change body of generated methods, choose Tools | Templates.
    //        System.out.println("Codebase: " + getHostServices().getCodeBase());
    //        System.out.println("getDocumentBase: " + getHostServices().getDocumentBase());
    Parameters parameters = getParameters();

    _config.parseParameters(parameters);
  }
  @BeforeClass
  public static void setupOnce() {
    // Start the Application
    new Thread(() -> Application.launch(MyApp.class, (String[]) null)).start();

    try {
      if (!launchLatch.await(TIMEOUT, TimeUnit.MILLISECONDS)) {
        throw new AssertionFailedError("Timeout waiting for Application to launch");
      }
    } catch (InterruptedException ex) {
      AssertionFailedError err = new AssertionFailedError("Unexpected exception");
      err.initCause(ex);
      throw err;
    }
  }
Exemplo n.º 10
0
  @Override
  public void init() throws Exception {
    super.init();

    try {
      GlobalScreen.registerNativeHook();
    } catch (NativeHookException e) {
      e.printStackTrace();
      System.exit(1);
    }

    // Add listeners
    GlobalScreen.addNativeMouseListener(this);
    GlobalScreen.addNativeMouseMotionListener(this);
    GlobalScreen.addNativeMouseWheelListener(this);

    // Disable parent logger and set the desired level.
    logger.setUseParentHandlers(false);
    logger.setLevel(Level.ALL);
  }
Exemplo n.º 11
0
 public static void main(String args[]) {
   Application.launch(RNGDominoSimulation.class, (java.lang.String[]) null);
 }
Exemplo n.º 12
0
 /** @param args the command line arguments */
 public static void main(String[] args) {
   Application.launch(Main.class, (java.lang.String[]) null);
 }
Exemplo n.º 13
0
  public static void main(String[] args) {
    boolean nio = false, server = false, client = false, multicast = false;

    Getopt g = new Getopt("MultiChat", args, "a:dhmnp:sc");
    int c;

    while ((c = g.getopt()) != -1) {
      switch (c) {
        case 'a':
          // set the ip address
          HOST = g.getOptarg();
          break;
        case 'd':
          // Mode debug (log dans la console)
          MyLogger.setConsoleMsg(true);
          break;
        case 'h':
          System.out.println(msgHelp);
          try {
            Thread.sleep(5000);
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
          System.exit(0);
        case 'm':
          // mode multicast
          multicast = true;
          break;
        case 'n':
          // mode client
          nio = true;
          break;
        case 'p':
          // Option -p pour spécifier port
          PORT = Integer.parseInt(g.getOptarg());
          break;
        case 's':
          server = true;
          break;
        case 'c':
          // option -c pour lancer client:
          client = true;
          break;
        case '?':
          break;
        default:
          System.out.print("getopt() returned " + c + "\n");
      }
    }

    if (MyLogger.isConsoleMsg()) {
      MyLogger.init(false);
    } else {
      MyLogger.init(true);
    }

    if (client) {
      if (multicast) {
        MainClient.setISMULTICAST(true);
      } else {
        MainClient.setISMULTICAST(false);
      }
      MainClient.setHOST(HOST);
      MainClient.setPORT(PORT);
      Application.launch(MainClient.class, args);
    } else if (server) {
      MainServer.setHOST(HOST);
      MainServer.setPORT(PORT);
      if (!nio) {
        // option -s pour lancer serveur (par défaut sans NIO):
        MainServer.main();
      } else {
        // -s -n pour lancer un serveur NIO:
        MainServer.mainNIO();
      }
    }
  }
Exemplo n.º 14
0
 @Override
 public void stop() throws Exception {
   super.stop();
   System.exit(0);
 }
Exemplo n.º 15
0
 @Test
 public void test() {
   //		fail("Not yet implemented");
   Application.launch(TextInputDialogApp.class);
 }
 @BeforeClass
 public static void setup() throws Exception {
   new Thread(() -> Application.launch(TestApp.class)).start();
   startupLatch.await();
 }
Exemplo n.º 17
0
 @FXML
 private void messageSearchWiki() {
   application
       .getHostServices()
       .showDocument("https://github.com/kamilfb/mqtt-spy/wiki/MessageSearch");
 }
Exemplo n.º 18
0
 @FXML
 private void openProjectWebsite() {
   application.getHostServices().showDocument("http://kamilfb.github.io/mqtt-spy/");
 }
Exemplo n.º 19
0
 public static void main(String[] args) {
   Application.launch(ControlTest.class, args);
 }
Exemplo n.º 20
0
 public static void main(String[] args) {
   // Application.setUserAgentStylesheet(null);
   // StyleManager.getInstance().addUserAgentStylesheet("/css/styles.css");
   Application.launch(args);
 }
Exemplo n.º 21
0
 @Test
 public void test() {
   Application.launch(ColorPickerApp.class);
 }
Exemplo n.º 22
0
 @Test
 public void test() {
   Application.launch(SwingInFXApp.class);
 }
Exemplo n.º 23
0
 public static void main(String[] args) {
   Application.launch(Main.class, args);
 }
Exemplo n.º 24
0
 @FXML
 private void loggingWiki() {
   application.getHostServices().showDocument("https://github.com/kamilfb/mqtt-spy/wiki/Logging");
 }
Exemplo n.º 25
0
 public static void main(String[] args) throws IOException {
   Application.launch();
 }
Exemplo n.º 26
0
  @Override
  public void start(Stage primaryStage) {
    primaryStage.setTitle("OpenBot");
    primaryStage.setResizable(false);
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER_LEFT);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    Label scenetitle = new Label("Move Joints");
    scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle, 2, 0, 5, 1);

    Image imgRight = new Image("images/arrowRight.png");
    Image imgLeft = new Image("images/arrowLeft.png");

    Button baseLeft = new Button();
    baseLeft.setGraphic(new ImageView(imgLeft));
    HBox hbbaseLeft = new HBox(10);
    hbbaseLeft.setAlignment(Pos.CENTER_LEFT);
    hbbaseLeft.getChildren().add(baseLeft);
    grid.add(hbbaseLeft, 0, 1);

    Label baseLabel = new Label("BASE");
    grid.add(baseLabel, 5, 1);

    Button baseRight = new Button();
    baseRight.setGraphic(new ImageView(imgRight));
    HBox hbbaseRight = new HBox(10);
    hbbaseRight.setAlignment(Pos.CENTER_RIGHT);
    hbbaseRight.getChildren().add(baseRight);
    grid.add(hbbaseRight, 7, 1);

    TextField baseText = new TextField();
    baseText.setPromptText("Base angle");
    grid.add(baseText, 8, 1);

    Button shoulderLeft = new Button();
    shoulderLeft.setGraphic(new ImageView(imgLeft));
    HBox hbshoulderLeft = new HBox(10);
    hbshoulderLeft.setAlignment(Pos.CENTER_LEFT);
    hbshoulderLeft.getChildren().add(shoulderLeft);
    grid.add(hbshoulderLeft, 0, 2);

    Label shoulderLabel = new Label("SHOULDER");
    grid.add(shoulderLabel, 5, 2);

    Button shoulderRight = new Button();
    shoulderRight.setGraphic(new ImageView(imgRight));
    HBox hbshoulderRight = new HBox(10);
    hbshoulderRight.setAlignment(Pos.CENTER_RIGHT);
    hbshoulderRight.getChildren().add(shoulderRight);
    grid.add(hbshoulderRight, 7, 2);

    TextField shoulderText = new TextField();
    shoulderText.setPromptText("Shoulder angle");
    grid.add(shoulderText, 8, 2);

    Button elbowLeft = new Button();
    elbowLeft.setGraphic(new ImageView(imgLeft));
    HBox hbelbowLeft = new HBox(10);
    hbelbowLeft.setAlignment(Pos.CENTER_LEFT);
    hbelbowLeft.getChildren().add(elbowLeft);
    grid.add(hbelbowLeft, 0, 3);

    Label elbowLabel = new Label("ELBOW");
    grid.add(elbowLabel, 5, 3);

    Button elbowRight = new Button();
    elbowRight.setGraphic(new ImageView(imgRight));
    HBox hbelbowRight = new HBox(10);
    hbelbowRight.setAlignment(Pos.CENTER_RIGHT);
    hbelbowRight.getChildren().add(elbowRight);
    grid.add(hbelbowRight, 7, 3);

    TextField elbowText = new TextField();
    elbowText.setPromptText("Elbow angle");
    grid.add(elbowText, 8, 3);

    Button wrist1Left = new Button();
    wrist1Left.setGraphic(new ImageView(imgLeft));
    HBox hbwrist1Left = new HBox(10);
    hbwrist1Left.setAlignment(Pos.CENTER_LEFT);
    hbwrist1Left.getChildren().add(wrist1Left);
    grid.add(hbwrist1Left, 0, 4);

    Label wrist1Label = new Label("WRIST 1");
    grid.add(wrist1Label, 5, 4);

    Button wrist1Right = new Button();
    wrist1Right.setGraphic(new ImageView(imgRight));
    HBox hbwrist1Right = new HBox(10);
    hbwrist1Right.setAlignment(Pos.CENTER_RIGHT);
    hbwrist1Right.getChildren().add(wrist1Right);
    grid.add(hbwrist1Right, 7, 4);

    TextField wrist1Text = new TextField();
    wrist1Text.setPromptText("Wrist 1 angle");
    grid.add(wrist1Text, 8, 4);

    Button wrist2Left = new Button();
    wrist2Left.setGraphic(new ImageView(imgLeft));
    HBox hbwrist2Left = new HBox(10);
    hbwrist2Left.setAlignment(Pos.CENTER_LEFT);
    hbwrist2Left.getChildren().add(wrist2Left);
    grid.add(hbwrist2Left, 0, 5);

    Label wrist2Label = new Label("WRIST 2");
    grid.add(wrist2Label, 5, 5);

    Button wrist2Right = new Button();
    wrist2Right.setGraphic(new ImageView(imgRight));
    HBox hbwrist2Right = new HBox(10);
    hbwrist2Right.setAlignment(Pos.CENTER_RIGHT);
    hbwrist2Right.getChildren().add(wrist2Right);
    grid.add(hbwrist2Right, 7, 5);

    TextField wrist2Text = new TextField();
    wrist2Text.setPromptText("Wrist 2 angle");
    grid.add(wrist2Text, 8, 5);

    Button wrist3Left = new Button();
    wrist3Left.setGraphic(new ImageView(imgLeft));
    HBox hbwrist3Left = new HBox(10);
    hbwrist3Left.setAlignment(Pos.CENTER_LEFT);
    hbwrist3Left.getChildren().add(wrist3Left);
    grid.add(hbwrist3Left, 0, 6);

    Label wrist3Label = new Label("WRIST 3");
    grid.add(wrist3Label, 5, 6);

    Button wrist3Right = new Button();
    wrist3Right.setGraphic(new ImageView(imgRight));
    HBox hbwrist3Right = new HBox(10);
    hbwrist3Right.setAlignment(Pos.CENTER_RIGHT);
    hbwrist3Right.getChildren().add(wrist3Right);
    grid.add(hbwrist3Right, 7, 6);

    TextField wrist3Text = new TextField();
    wrist3Text.setPromptText("Wrist 3 angle");
    grid.add(wrist3Text, 8, 6);

    Button sendAllAnglesButton = new Button("Send All Angles");
    grid.add(sendAllAnglesButton, 8, 7);

    sendAllAnglesButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(baseText.getText());
            if (currentValue != -1) {
              client.moveBaseHorizontalTo(currentValue);
            }
            currentValue = parseInt(shoulderText.getText());
            if (currentValue != -1) {
              client.moveShoulderTo(currentValue);
            }
            currentValue = parseInt(elbowText.getText());
            if (currentValue != -1) {
              client.moveElbowTo(currentValue);
            }
            currentValue = parseInt(wrist1Text.getText());
            if (currentValue != -1) {
              client.moveWristOneTo(currentValue);
            }
            currentValue = parseInt(wrist2Text.getText());
            if (currentValue != -1) {
              client.moveWristTwoTo(currentValue);
            }
            currentValue = parseInt(wrist3Text.getText());
            if (currentValue != -1) {
              client.moveWristThreeTo(currentValue);
            }
          }
        });

    baseLeft.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(baseText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              baseText.setText(String.valueOf(targetValue));
              client.moveBaseHorizontalTo(targetValue);
            }
          }
        });

    baseRight.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(baseText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              baseText.setText(String.valueOf(targetValue));
              client.moveBaseHorizontalTo(targetValue);
            }
          }
        });

    shoulderLeft.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(shoulderText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              shoulderText.setText(String.valueOf(targetValue));
              client.moveShoulderTo(targetValue);
            }
          }
        });

    shoulderRight.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(shoulderText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              shoulderText.setText(String.valueOf(targetValue));
              client.moveShoulderTo(targetValue);
            }
          }
        });

    elbowLeft.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(elbowText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              elbowText.setText(String.valueOf(targetValue));
              client.moveElbowTo(targetValue);
            }
          }
        });

    elbowRight.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(elbowText.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              elbowText.setText(String.valueOf(targetValue));
              client.moveElbowTo(targetValue);
            }
          }
        });

    wrist1Left.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist1Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              wrist1Text.setText(String.valueOf(targetValue));
              client.moveWristOneTo(targetValue);
            }
          }
        });

    wrist1Right.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist1Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              wrist1Text.setText(String.valueOf(targetValue));
              client.moveWristOneTo(targetValue);
            }
          }
        });

    wrist2Left.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist2Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              wrist2Text.setText(String.valueOf(targetValue));
              client.moveWristTwoTo(targetValue);
            }
          }
        });

    wrist2Right.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist2Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              wrist2Text.setText(String.valueOf(targetValue));
              client.moveWristTwoTo(targetValue);
            }
          }
        });

    wrist3Left.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist3Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue - 1;
              wrist3Text.setText(String.valueOf(targetValue));
              client.moveWristThreeTo(targetValue);
            }
          }
        });

    wrist3Right.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int currentValue = parseInt(wrist3Text.getText());
            if (currentValue != -1) {
              int targetValue = currentValue + 1;
              wrist3Text.setText(String.valueOf(targetValue));
              client.moveWristThreeTo(targetValue);
            }
          }
        });

    Label scenetitle2 = new Label("Enter Angle");
    scenetitle2.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle2, 8, 0, 5, 1);

    Label scenetitle3 = new Label("Tool Position");
    scenetitle3.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle3, 10, 0, 5, 1);

    String xValue = "360.0";
    grid.add(x, 11, 1);
    x.setText("X :  " + xValue);

    String yValue = "360.0";
    grid.add(y, 11, 2);
    y.setText("Y :  " + yValue);

    String zValue = "360.0";
    grid.add(z, 11, 3);
    z.setText("Z :  " + zValue);

    String rxValue = "360.0";
    grid.add(rx, 11, 4);
    rx.setText("RX :  " + rxValue);

    String ryValue = "360.0";
    grid.add(ry, 11, 5);
    ry.setText("RY :  " + ryValue);

    String rzValue = "360.0";
    grid.add(rz, 11, 6);
    rz.setText("RZ :  " + rzValue);

    // Scene
    Scene scene = new Scene(grid, 700, 600);
    primaryStage.setScene(scene);
    primaryStage.show();

    primaryStage.setOnCloseRequest(
        new EventHandler<WindowEvent>() {
          @Override
          public void handle(WindowEvent event) {
            client.killClient();
          }
        });

    Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
    StyleManager.getInstance()
        .addUserAgentStylesheet(
            this.getClass().getResource("/resources/styleSheet.css").toExternalForm());
  }
Exemplo n.º 27
0
 @FXML
 private void openGettingInvolved() {
   application
       .getHostServices()
       .showDocument("https://github.com/kamilfb/mqtt-spy/wiki/Getting-involved");
 }
Exemplo n.º 28
0
 public static void main(String[] args) {
   Application.launch(BlackmarketApplication.class, args);
 }
Exemplo n.º 29
0
 public static void main(String[] args) {
   Application.launch(args);
 }
Exemplo n.º 30
0
 @FXML
 private void overviewWiki() {
   application.getHostServices().showDocument("https://github.com/kamilfb/mqtt-spy/wiki/Overview");
 }