Beispiel #1
1
  public void loadMapNumbers(Group root) {
    Group group = new Group();
    group.setLayoutX(600);
    group.setLayoutY(600);

    cb = new ChoiceBox();
    loadNumberChoiceBox();

    Button b1 = new Button("Go");
    b1.setLayoutY(25);
    Gui.Listener.EditorChangeMapListener editorCML = new Gui.Listener.EditorChangeMapListener();
    editorCML.setChoiceBox(cb);
    b1.setOnAction(editorCML);

    Button b2 = new Button("Delete");
    b2.setLayoutY(50);

    editorCML.setChoiceBox(cb);
    b1.setOnAction(editorCML);

    group.getChildren().add(b1);
    group.getChildren().add(b2);
    group.getChildren().add(cb);
    root.getChildren().add(group);
  }
  @Override
  public void load() throws CannotCreatePreviewerException {

    pdf = new PdfDecoder();

    this.setPrefSize(maxSize.getWidth(), maxSize.getHeight());
    AnchorPane anchor = new AnchorPane();
    this.getChildren().add(anchor);
    anchor.setStyle("-fx-border-color: black; -fx-border-width: 1; -fx-background-color: black;");

    imageView = new ImageView();
    AnchorPane.setLeftAnchor(imageView, 0.0);
    AnchorPane.setTopAnchor(imageView, 0.0);
    AnchorPane.setRightAnchor(imageView, 1.0);
    AnchorPane.setBottomAnchor(imageView, 1.0);

    back = new Button("<");
    back.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent t) {
            showPage(pageNumber - 1);
          }
        });
    back.setPrefSize(50, 50);
    AnchorPane.setLeftAnchor(back, 3.0);
    AnchorPane.setBottomAnchor(back, 4.0);

    next = new Button(">");
    next.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent t) {
            showPage(pageNumber + 1);
          }
        });
    next.setPrefSize(50, 50);
    AnchorPane.setRightAnchor(next, 4.0);
    AnchorPane.setBottomAnchor(next, 4.0);

    // Add buttons to list
    buttonGroup = new ArrayList<Button>();
    buttonGroup.add(next);
    buttonGroup.add(back);

    // Set buttons to transparent
    setButtonOpacities(0.0);

    // Set up mouse listener & add to components
    MouseListener listener = new MouseListener();
    imageView.addEventHandler(MouseEvent.ANY, listener);
    back.addEventHandler(MouseEvent.ANY, listener);
    next.addEventHandler(MouseEvent.ANY, listener);

    // Add components
    anchor.getChildren().addAll(imageView, next, back);

    // Check parameters for file to open - if not show chooser
    openFile(new File(absoluteFilePath));
  }
  public Node getPolizistAnsicht() {
    if (PolizistAnsichtGeneriert) {
      refreshPolizistAnsicht();
      return DatenAnsicht;
    }
    IM.setInfoText("Lade Polizist Ansicht");
    DatenAnsicht = new BorderPane(getPolizistAnsichtInnereTabelle());

    HBox ButtonLeiste = new HBox(10);
    ButtonLeiste.setPadding(new Insets(10));

    Button ButtonNeue = new Button("Neuer Eintrag...");
    Button ButtonChan = new Button("Eintrag ändern...");
    Button ButtonDele = new Button("Eintrag löschen");

    ButtonNeue.setOnAction(event -> insertNewEntry());
    ButtonChan.setOnAction(event -> updateSelectedEntry());
    ButtonDele.setOnAction(event -> deleteSelectedEntrys());

    ButtonLeiste.getChildren().addAll(ButtonNeue, ButtonChan, ButtonDele);
    DatenAnsicht.setBottom(ButtonLeiste);

    IM.setInfoText("Laden der Polizist Ansicht erfolgreich");
    PolizistAnsichtGeneriert = true;
    return DatenAnsicht;
  }
  public static boolean display(String title, String message) {
    Stage window = new Stage();
    answer = false;

    // Block events to other windows. means don't allow control of the first window untill this
    // window is closed.
    window.initModality(Modality.APPLICATION_MODAL);
    window.setTitle(title);
    window.setMinWidth(250);

    Label label = new Label();
    label.setText(message);

    // Create two buttons
    Button yesButton = new Button("Yes");
    Button noButton = new Button("No");
    yesButton.setOnAction(
        e -> {
          answer = true;
          window.close();
        });
    noButton.setOnAction(e -> window.close());

    VBox layout = new VBox(10);
    layout.getChildren().addAll(label, yesButton, noButton);
    layout.setAlignment(Pos.CENTER);

    // Display window and wait for it to be closed before returning
    Scene scene = new Scene(layout);
    window.setScene(scene);
    //        window.show();
    window.showAndWait(); // show the window & wait unitl it's closed

    return answer;
  }
  public static boolean display(String title, String message) {
    Stage window = new Stage();
    window.initModality(Modality.APPLICATION_MODAL);

    Label l1 = new Label(message);

    // Create 2 buttons
    Button yesBtn = new Button("Yes");
    Button noBtn = new Button("No");

    yesBtn.setOnAction(
        e -> {
          ans = true;
          window.close();
        });

    noBtn.setOnAction(
        e -> {
          ans = false;
          window.close();
        });

    HBox hbox = new HBox(10);
    hbox.getChildren().addAll(l1, yesBtn, noBtn);
    hbox.setAlignment(Pos.CENTER);

    Scene sc = new Scene(hbox);

    window.setScene(sc);
    window.setTitle(title);
    window.setMinWidth(250);
    window.showAndWait();

    return ans;
  }
Beispiel #6
0
  private Pane createControlsPane(double spacing) {

    Button startClientButton = new Button("Start Client");
    startClientButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent t) {
            orca.start();
          }
        });
    Button stopClientButton = new Button("Stop Client");
    stopClientButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent t) {
            orca.stop();
          }
        });

    HBox clientControls =
        HBoxBuilder.create().spacing(spacing).children(startClientButton, stopClientButton).build();

    Runtime.getRuntime()
        .addShutdownHook(
            new Thread(
                new Runnable() {
                  @Override
                  public void run() {
                    orca.stop();
                  }
                }));

    return clientControls;
  }
 /**
  * @param event Triggered by set button under the combobox
  *     <p>Sets the game mode to either setter or guesser
  */
 public void setMode(ActionEvent event) {
   if (modeSet.getValue() == "Setter") {
     reset();
     guessSet.setDisable(false);
     guessSet.setText("Set Solution");
     setPins.setDisable(false);
     guessSet.setOnAction(
         new EventHandler<ActionEvent>() {
           @Override
           public void handle(ActionEvent e) {
             setSolution();
           }
         });
   } else {
     reset();
     guessSet.setText("Guess");
     setPins.setDisable(true);
     deleteButton.setDisable(false);
     guessSet.setOnAction(
         new EventHandler<ActionEvent>() {
           @Override
           public void handle(ActionEvent e) {
             addGuess(e);
           }
         });
   }
 }
Beispiel #8
0
 private void registerListeners() {
   buttonLoadBackgroundImage.setOnAction(
       observable -> handleControlPropertyChanged("LOAD_BACKGROUND"));
   buttonLoadHeatMapImage.setOnAction(observable -> handleControlPropertyChanged("LOAD_HEATMAP"));
   toggleButtonShowHeatMap.setOnAction(
       observable -> handleControlPropertyChanged("TOGGLE_HEATMAP"));
 }
Beispiel #9
0
 public TabButtonPane() {
   super(10);
   setAlignment(Pos.CENTER);
   getStyleClass().add("dark-pane");
   setId("tab-button-pane");
   setMinHeight(75);
   Button newButton = FontAwesome.createIconButton(FontAwesome.PLUS, "new", true, "green");
   newButton.setOnAction(
       new EventHandler<ActionEvent>() {
         @Override
         public void handle(ActionEvent actionEvent) {
           new ConnectStage(Mercury.getStage());
         }
       });
   Button websiteButton = FontAwesome.createIconButton(FontAwesome.GLOBE, "", true, null);
   websiteButton.setOnAction(
       new EventHandler<ActionEvent>() {
         @Override
         public void handle(ActionEvent actionEvent) {
           try {
             Desktop.getDesktop().browse(new URI(Mercury.WEBSITE));
           } catch (URISyntaxException | IOException e) {
             e.printStackTrace();
           }
         }
       });
   Button settingsButton = FontAwesome.createIconButton(FontAwesome.COG, "", true, null);
   getChildren().addAll(newButton, websiteButton, settingsButton);
 }
 ModulesDashboardTile(Module module) {
   getStyleClass().addAll("dashboard-modules-tile");
   Label titleLabel = new Label(module.descriptor().getName());
   titleLabel.getStyleClass().add("dashboard-modules-tile-title");
   titleLabel.setGraphic(module.graphic());
   Label textLabel = new Label(module.descriptor().getDescription());
   textLabel.getStyleClass().add("dashboard-modules-tile-text");
   textLabel.setMinHeight(USE_PREF_SIZE);
   topTile.getChildren().addAll(titleLabel, textLabel);
   button.getStyleClass().add("dashboard-modules-invisible-button");
   button.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
   button.setOnAction(e -> eventStudio().broadcast(activeteModule(module.id())));
   armed.bind(button.armedProperty());
   VBox inner = new VBox(new StackPane(topTile, button));
   prefHeightProperty().bind(inner.heightProperty());
   setMaxHeight(USE_PREF_SIZE);
   setMinHeight(USE_PREF_SIZE);
   inner.getStyleClass().add("dashboard-modules-tile-inner");
   getChildren().add(inner);
   module
       .descriptor()
       .getSupportURL()
       .ifPresent(
           url -> {
             Button playButton = AwesomeDude.createIconButton(AwesomeIcon.YOUTUBE_PLAY, "");
             playButton.getStyleClass().add("pdfsam-toolbar-button");
             playButton.setOnAction(e -> eventStudio().broadcast(new OpenUrlRequest(url)));
             toolButtons.getChildren().add(playButton);
             toolButtons.getStyleClass().add("dashboard-modules-toolbar");
             inner.getChildren().add(toolButtons);
           });
 }
Beispiel #11
0
  public void start(final Stage primaryStage) {
    primaryStage.setTitle("Popup Example");
    final Popup popup = new Popup();
    popup.setX(300);
    popup.setY(200);
    popup.getContent().addAll(new Circle(25, 25, 50, Color.AQUAMARINE));

    Button show = new Button("Show");
    show.setOnAction(
        new EventHandler<ActionEvent>() {
          public void handle(ActionEvent event) {
            popup.show(primaryStage);
          }
        });

    Button hide = new Button("Hide");
    hide.setOnAction(
        new EventHandler<ActionEvent>() {
          public void handle(ActionEvent event) {
            popup.hide();
          }
        });

    HBox layout = new HBox(10);
    layout.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
    layout.getChildren().addAll(show, hide);
    primaryStage.setScene(new Scene(layout));
    primaryStage.show();
  }
  public void initialize() throws IOException {

    lblMessage.setText("");
    lblMessage.setText("Send Oil Change Reminder Message?");

    btnCancelMessage.setOnAction(
        e -> {
          // System.exit(0);
          Stage stageBox = (Stage) btnCancelMessage.getScene().getWindow();
          stageBox.close();
        });
    btnSendMessage.setOnAction(
        e -> {
          lblMessage.setText("");
          lblMessage.setText("Message Sent!");

          try {
            btnCancelMessage.setAlignment(Pos.CENTER);
            btnSendMessage.setVisible(false);
            btnCancelMessage.setText("Done!");
            Parent stageBox = btnCancelMessage.getParent();
            ((BorderPane) stageBox).setCenter(btnCancelMessage);
          } catch (Exception exception) {
          }
        });
  }
  public void start(Stage primaryStage) throws Exception {
    window = primaryStage;

    Label label1 = new Label("Welcome to the first scene");
    Button button1 = new Button("Go to scene 2");

    button1.setOnAction(e -> window.setScene(scene2));

    // layout 1 - children in vertical column
    // spaced out by 20 pixels
    VBox layout1 = new VBox(20);
    // add to the layout
    layout1.getChildren().addAll(label1, button1);
    // create the first scene
    scene1 = new Scene(layout1, 200, 200);

    // button2
    Button button2 = new Button("Go to scene 1");
    button2.setOnAction(e -> window.setScene(scene1));

    // layout 2
    StackPane layout2 = new StackPane();
    // add to the layout
    layout2.getChildren().add(button2);
    // create the scene
    scene2 = new Scene(layout2, 600, 300);

    // set default scene where to start the program
    window.setScene(scene1);
    window.setTitle("Title here");
    window.show();
  }
  @FXML
  public void initialize() {
    initializeWorkflowProcessesComboBox();

    // TODO (artf231901): must move to model to handle other WorkflowProcessModel types
    instructionsTextArea.clear();

    promotionPathCoordinateLabel.setText(getDefaultPromotionPathCoordinateTextFieldContent());

    instructionsTextArea.setOnKeyTyped(
        (e) -> initiateButton.setDisable(!isDataRequiredForInitiateOk()));
    instructionsTextArea.addEventHandler(
        InputEvent.ANY,
        new EventHandler<InputEvent>() {
          @Override
          public void handle(InputEvent event) {
            initiateButton.setDisable(!isDataRequiredForInitiateOk());
          }
        });

    cancelButton.setOnAction((e) -> doCancel());

    initiateButton.setDisable(!isDataRequiredForInitiateOk());
    initiateButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            initiateWorkflow();
          }
        });
  }
  // Add new account form
  private void addNewAccount() {
    paymentAccountsListView.getSelectionModel().clearSelection();
    removeAccountRows();
    addAccountButton.setDisable(true);
    accountTitledGroupBg =
        addTitledGroupBg(root, ++gridRow, 1, "Create new account", Layout.GROUP_DISTANCE);

    if (paymentMethodForm != null) {
      FormBuilder.removeRowsFromGridPane(root, 3, paymentMethodForm.getGridRow() + 1);
      GridPane.setRowSpan(accountTitledGroupBg, paymentMethodForm.getRowSpan() + 1);
    }
    gridRow = 2;
    paymentMethodForm = getPaymentMethodForm(PaymentMethod.BLOCK_CHAINS);
    if (paymentMethodForm != null) {
      paymentMethodForm.addFormForAddAccount();
      gridRow = paymentMethodForm.getGridRow();
      Tuple2<Button, Button> tuple2 =
          add2ButtonsAfterGroup(root, ++gridRow, "Save new account", "Cancel");
      saveNewAccountButton = tuple2.first;
      saveNewAccountButton.setOnAction(
          event -> onSaveNewAccount(paymentMethodForm.getPaymentAccount()));
      saveNewAccountButton.disableProperty().bind(paymentMethodForm.allInputsValidProperty().not());
      Button cancelButton = tuple2.second;
      cancelButton.setOnAction(event -> onCancelNewAccount());
      GridPane.setRowSpan(accountTitledGroupBg, paymentMethodForm.getRowSpan() + 1);
    }
  }
Beispiel #16
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setVgap(10);
    grid.setHgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    Scene sc = new Scene(grid, 500, 500);

    String css = Main.class.getResource("Login.css").toExternalForm();
    //        System.out.println(css);
    sc.getStylesheets().add(css);

    Text scenetitle = new Text("Welcome");
    //        scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle, 0, 0, 1, 1);

    Label userName = new Label("User Name:");
    grid.add(userName, 0, 1);

    TextField userTextField = new TextField("Мудак");
    grid.add(userTextField, 1, 1);

    Label pw = new Label("Password:"******"Sign in");
    HBox hbBtn = new HBox(10);
    hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
    hbBtn.getChildren().add(btn);
    grid.add(hbBtn, 1, 4);

    final Text actiontarget = new Text();
    grid.add(actiontarget, 1, 6);

    btn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            //                actiontarget.setFill(Color.FIREBRICK);
            actiontarget.setText("Pressed");
          }
        });

    //        grid.setGridLinesVisible(true);

    scenetitle.setId("welc");
    actiontarget.setId("act");

    primaryStage.setScene(sc);
    primaryStage.setTitle("Hello World");
    primaryStage.show();
  }
  /** Shows this Notifications popup */
  public void show() {
    // Use a gridpane to display the component
    GridPane pane = new GridPane();
    // Need a new scene to display the popup
    Scene scene = new Scene(pane);

    // Set the padding and gaps to 5px
    pane.setPadding(new Insets(5));
    pane.setHgap(5);
    pane.setVgap(5);

    // Add the message as a label if there is one
    if (message != null) {
      Label lblMsg = new Label(message);

      lblMsg.setPadding(new Insets(20));
      pane.add(lblMsg, 0, 0, 3, 1);
    }

    // Add the yes/no buttons if there are any
    if (yesNoBtns) {
      Button btnYes = new Button("Yes");
      Button btnNo = new Button("No");

      // Add the events and set as default/cancel buttons
      btnYes.setDefaultButton(true);
      btnYes.setOnAction(yesNoEvent);
      btnNo.setCancelButton(true);
      btnNo.setOnAction(yesNoEvent);

      // Align them to the right
      GridPane.setHalignment(btnNo, HPos.RIGHT);
      GridPane.setHalignment(btnYes, HPos.RIGHT);

      // Push the buttons to the right
      Region spacer = new Region();
      GridPane.setHgrow(spacer, Priority.ALWAYS);

      pane.add(spacer, 0, 1);
      pane.add(btnNo, 1, 1);
      pane.add(btnYes, 2, 1);
    }

    // Create a new stage to show the scene
    Stage stage = new Stage();

    stage.setScene(scene);
    // Don't want the popup to be resizable
    stage.setResizable(false);
    // Set the title if there is one
    if (title != null) {
      stage.setTitle(title);
    }
    // Resize it and show it
    stage.sizeToScene();
    stage.showAndWait();
  }
Beispiel #18
0
  @Override
  public void start(Stage primaryStage) {

    Label inputLabel = new Label("Input");

    TextArea input = new TextArea();
    input.setFont(MONOSPACE_FONT);
    setSize(input, INPUT_WIDTH, INPUT_HEIGHT);

    Label outputLabel = new Label("Output");

    TextArea output = new TextArea();
    output.setEditable(false);
    output.setFont(MONOSPACE_FONT);
    setSize(output, OUTPUT_WIDTH, OUTPUT_HEIGHT);

    TextArea codeArea = new TextArea();
    codeArea.setFont(MONOSPACE_FONT);
    setSize(codeArea, EDITOR_WIDTH, EDITOR_HEIGHT);

    Button runButton = new Button("Run");
    runButton.setOnAction(
        e -> {
          try {
            output.setText(new A_RayCode(codeArea.getText(), input.getText()).runAndGetOutput());
          } catch (RuntimeException exception) {
            output.setText("Error");
            exception.printStackTrace();
          }
        });

    Button clearOutput = new Button("Clear Output");
    clearOutput.setOnAction(
        e -> {
          output.setText("");
        });

    HBox buttonPane = new HBox();
    buttonPane.setSpacing(PANE_SPACING);
    buttonPane.setAlignment(Pos.CENTER_RIGHT);
    buttonPane.getChildren().addAll(clearOutput, runButton);

    VBox mainPane = new VBox();
    mainPane.setPadding(MAIN_PANE_INSETS);
    mainPane.setSpacing(PANE_SPACING);

    mainPane.getChildren().addAll(codeArea, buttonPane, inputLabel, input, outputLabel, output);

    BorderPane content = new BorderPane(mainPane);

    Scene scene = new Scene(content, WIDTH, HEIGHT);

    primaryStage.setScene(scene);
    primaryStage.setResizable(false);
    primaryStage.show();
  }
Beispiel #19
0
  public void displayPane() throws IOException {

    addStationsToCB();

    paneTop.getColumnConstraints().add(new ColumnConstraints(60));
    paneTop.getColumnConstraints().add(new ColumnConstraints(200));
    paneTop.getColumnConstraints().add(new ColumnConstraints(100));

    paneBot.getColumnConstraints().add(new ColumnConstraints(60));
    paneBot.getColumnConstraints().add(new ColumnConstraints(200));
    paneBot.getColumnConstraints().add(new ColumnConstraints(100));

    paneCenter.getColumnConstraints().add(new ColumnConstraints(300));

    paneTop.setPadding(new Insets(10, 10, 10, 10));
    paneTop.setAlignment(Pos.CENTER);
    paneTop.setHgap(5);
    paneTop.setVgap(5);

    paneBot.setPadding(new Insets(10, 10, 10, 10));
    paneBot.setAlignment(Pos.CENTER);
    paneBot.setHgap(5);
    paneBot.setVgap(5);

    paneTop.add(new Label("Station :"), 0, 0);
    paneTop.add(cbStations, 1, 0);
    paneTop.add(btOpen, 2, 0);

    paneBot.add(new Label("Quantity :"), 0, 0);
    paneBot.add(cbQuantity, 1, 0);
    paneBot.add(btShow, 2, 0);

    paneTop.setHalignment(btOpen, HPos.RIGHT);
    paneBot.setHalignment(btShow, HPos.RIGHT);

    paneCenter.setHgap(5);
    paneCenter.setVgap(5);
    paneCenter.setAlignment(Pos.CENTER);
    sp.setContent(paneCenter);
    sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
    bp.setMargin(sp, new Insets(20, 50, 40, 50));
    bp.setTop(paneTop);
    bp.setCenter(sp);
    bp.setBottom(paneBot);

    btOpen.setOnAction(
        e -> {
          try {
            open();
          } catch (IOException er) {
            er.printStackTrace();
          }
        });

    btShow.setOnAction(e -> showGraph());
  }
  private void setCaracteristicasAlContenedorPrincipal() {

    Button botonJuegosExistentes = new Button("Juegos existentes");
    botonJuegosExistentes.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    botonJuegosExistentes.setTextFill(Color.WHITE);

    BackgroundFill fondoDeColorJuegosExistentes =
        new BackgroundFill(Color.RED, new CornerRadii(5), new Insets(0.0, 0.0, 0.0, 0.0));
    botonJuegosExistentes.setBackground(new Background(fondoDeColorJuegosExistentes));

    botonJuegosExistentes.setOnMouseEntered(
        e -> {
          botonJuegosExistentes.setScaleX(1.3);
          botonJuegosExistentes.setScaleY(1.3);
        });

    botonJuegosExistentes.setOnMouseExited(
        e -> {
          botonJuegosExistentes.setScaleX(1);
          botonJuegosExistentes.setScaleY(1);
        });

    botonJuegosExistentes.setOnAction(
        e -> {
          VistaJuegosExistentes nuevaVista = new VistaJuegosExistentes(this);
          nuevaVista.mostrar();
        });

    Button botonNuevoJuego = new Button("Nuevo juego");
    botonNuevoJuego.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    botonNuevoJuego.setTextFill(Color.WHITE);

    BackgroundFill fondoDeColorNuevoJuego =
        new BackgroundFill(Color.RED, new CornerRadii(5), new Insets(0.0, 0.0, 0.0, 0.0));
    botonNuevoJuego.setBackground(new Background(fondoDeColorNuevoJuego));

    botonNuevoJuego.setOnMouseEntered(
        e -> {
          botonNuevoJuego.setScaleX(1.3);
          botonNuevoJuego.setScaleY(1.3);
        });

    botonNuevoJuego.setOnMouseExited(
        e -> {
          botonNuevoJuego.setScaleX(1);
          botonNuevoJuego.setScaleY(1);
        });

    botonNuevoJuego.setOnAction(
        e -> {
          VistaEleccionVarianteFlor nuevaVista = new VistaEleccionVarianteFlor(this);
          nuevaVista.mostrar();
        });

    this.contenedor.getChildren().addAll(botonJuegosExistentes, botonNuevoJuego);
  }
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    // TODO 自動生成されたメソッド・スタブ
    addOption.setOnAction(
        event -> {
          for (int i = 0; i < cmb.size(); i++) {
            //				System.out.println(cmb.get(i).getValue());
            if (cmb.get(i).getValue() == null) {
              break;
            } else if (i == cmb.size() - 1) {
              addTask.setDisable(false);
            }
          }
        });

    addTask.setOnAction(
        event -> {
          try {
            String url = webView.getEngine().getLocation();
            System.out.println(url);
            Document document = Jsoup.connect(url).get();

            Elements input = document.select("input");

            Map params = new HashMap<String, String>();
            for (ComboBox cmbx : cmb) {
              ValuePair vp = (ValuePair) cmbx.getValue();
              params.put(vp.getName(), vp.getvalue());
            }
            //				System.out.println(input.select("[name=shop_bid]").first());
            //				System.out.println(input.select("[name=shop_bid]").first().val());
            params.put("shop_bid", input.select("[name=shop_bid]").first().val());
            params.put("item_id", input.select("[name=item_id]").first().val());
            params.put("__event", input.select("[name=__event]").first().val());
            params.put("units", "1");

            Map map = new HashMap<String, Long>();

            //				System.out.println(document.select("#stime").size());
            if (document.select("#stime").size() != 0) {
              System.out.println(document.select("#stime"));
              map.put("stime", Long.parseLong((input.select("#stime").first().val())));
              map.put("etime", Long.parseLong((input.select("#etime").first().val())));
            } else {
              map = null;
            }

            BuyTask task = new BuyTask(url, params, map);
            task.call();
            this.getScene().getWindow().hide();
          } catch (Exception e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
          }
        });
  }
Beispiel #22
0
  private void CreateForm() throws SQLException {
    box = new VBox();
    HBox Hbox = new HBox();
    Hbox.setAlignment(Pos.CENTER);
    Hbox.getChildren().add(box);
    Hbox.setLayoutX(width / 2 - Hbox.getWidth() / 2);
    root.getChildren().add(Hbox);
    root.getChildren().add(box);

    // final Label logn=new Label("For connecting to the database press the button ");
    final Button ok = new Button("Connect to server");

    box.setAlignment(Pos.TOP_CENTER);
    box.maxWidth(width);
    box.minWidth(width);

    log = "root";
    psswrd = "0000";

    Hbox.setLayoutX(width / 2 - 135);
    Hbox.setLayoutY(height / 2 - 80);

    final Button ok2 = new Button("Connect to server");
    ok2.setOnAction(event -> System.out.println("Button was pressed."));

    ok.setOnAction(
        event -> {
          try {
            System.out.println("Button was pressed.");
            db = new MySQLAccess("univer", log, psswrd);
            // logn.setVisible(false);
            ok.setVisible(false);
            /*final Button qq=new Button("qq");
            ok.setLayoutX(width / 2 - 80);
            ok.setLayoutY(height / 2 - 80);
            box.setAlignment(Pos.TOP_CENTER);
            box.maxWidth(width);
            box.minWidth(width);
            box.getChildren().addAll(qq);*/
            OutputInformation();
            /* final Button qq=new Button("qq");
            ok.setLayoutX(width / 2 - 80);
            ok.setLayoutY(height / 2 - 80);
            box.setAlignment(Pos.TOP_CENTER);
            box.maxWidth(width);
            box.minWidth(width);
            box.getChildren().addAll(qq);*/
          } catch (ClassNotFoundException e) {
            System.out.println(e);
          } catch (SQLException e) {
            System.out.println(e);
          }
        });

    box.getChildren().add(ok2);
  }
Beispiel #23
0
  public FamilyForm() {

    getStylesheets().add("/CSS/familyFormCss.css");

    save = new Button("Save");
    cancel = new Button("Cancel");

    Title.setFontSmoothingType(FontSmoothingType.LCD);
    Title.setFont(javafx.scene.text.Font.font(20));

    scrollPane = new ScrollPane(getSubGrid());
    scrollPane.setFitToWidth(true);

    save.setPrefWidth(80);
    cancel.setPrefWidth(80);

    clientID = Controller.getInstance().getStaffInfo().getAccountID();

    /////////////////////////////////// MAIN PANE ///////////////////////////////////

    setConstraints(Title, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER);
    setConstraints(scrollPane, 0, 1, 1, 1, HPos.CENTER, VPos.CENTER);

    getChildren().addAll(Title, scrollPane);

    save.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            if (Validate()) {
              String name = Name.getText().trim();

              if (Controller.isNotified && orginalName.equals("")) {
                orginalName = name;
              } else if (Controller.isNotified && !(orginalName.equals(""))) {
                if (!orginalName.equals(name)) {
                  orginalName = name;
                  Controller.isNotified = false;
                }
              }
              Save();
            }
          }
        });

    cancel.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            clear();
          }
        });
  }
 private HBox createActionPane() {
   HBox actionBox = new HBox();
   actionBox.setSpacing(10);
   actionBox.setPadding(new Insets(20, 0, 10, 0));
   actionBox.setAlignment(Pos.CENTER);
   startBtn.setMinWidth(80);
   pauseBtn.setMinWidth(80);
   startBtn.setOnAction(btnHandler);
   pauseBtn.setOnAction(btnHandler);
   actionBox.getChildren().addAll(startBtn, pauseBtn);
   return actionBox;
 }
  public void initContent(GridPane pane) {
    // pane.setGridLinesVisible(true);
    pane.setPadding(new Insets(20));
    pane.setHgap(10);
    pane.setVgap(20);

    // header label
    Label lblHeader = new Label("Alert Dialogs");
    pane.add(lblHeader, 1, 0);
    lblHeader.setTextFill(Color.DARKBLUE);
    lblHeader.setFont(Font.font("Calibri", FontWeight.BOLD, 36));

    // label for input text field
    Label lblInput = new Label("A Text field:");
    pane.add(lblInput, 0, 1);
    lblInput.setFont(Font.font("Calibri", FontWeight.NORMAL, 20));

    // input text field
    this.txfInput = new TextField();
    pane.add(txfInput, 1, 1);
    this.txfInput.setMinHeight(30.0);
    this.txfInput.setPromptText("Enter some text and save.");

    // horizontal box for buttons
    HBox hbox = new HBox(20);
    pane.add(hbox, 1, 2);
    hbox.setAlignment(Pos.CENTER);

    // info button
    Button btnInfo = new Button("Info");
    btnInfo.setOnAction(event -> this.infoAction());
    hbox.getChildren().add(btnInfo);

    // save button
    Button btnSave = new Button("Save");
    btnSave.setOnAction(event -> this.saveAction());
    hbox.getChildren().add(btnSave);

    // clear button
    Button btnClear = new Button("Clear");
    btnClear.setOnAction(event -> this.clearAction());
    hbox.getChildren().add(btnClear);

    // status text
    this.txtStatus = new Text();
    pane.add(txtStatus, 0, 4, 3, 1);
    this.txtStatus.setFont(Font.font("Calibri", FontWeight.NORMAL, 20));
    this.txtStatus.setFill(Color.FIREBRICK);
    this.txtStatus.setText("An example of Alert Dialogs. Enter some text and save.");

    btnInfo.requestFocus();
  }
  private static void setButtonsActions() {
    sign_in_button.setOnAction(
        event -> {
          try {
            if ((username.getText().length() > 3) && (password.getText().length() > 3)) {
              UserData.saveData();
              UserCommands.authorization();
              synchronized (ThreadStorage.getInterfaceLauncher()) {
                ThreadStorage.getInterfaceLauncher().wait();
              }
              if (UserData.authorized) {
                loginForm.close();
                MainProgram.getMainProgram().launchForm();
              }
            } else {
              error_message_field.setText("Too short username or password");
            }
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
        });

    register_button.setOnAction(
        event -> {
          try {
            if ((username.getText().length() > 3) && (password.getText().length() > 3)) {
              UserData.saveData();
              UserCommands.user_exists();
              synchronized (ThreadStorage.getInterfaceLauncher()) {
                ThreadStorage.getInterfaceLauncher().wait();
              }
              if (!user_exists) {
                CategoryForm.launchForm();
                UserCommands.register();
                synchronized (ThreadStorage.getInterfaceLauncher()) {
                  ThreadStorage.getInterfaceLauncher().wait();
                }
                if (UserData.authorized) {
                  LoginForm.closeForm();
                  MainProgram.getMainProgram().launchForm();
                }
              } else {
                error_message_field.setText("Username is already existed");
              }
            } else {
              error_message_field.setText("Too short username or password");
            }
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
        });
  }
Beispiel #27
0
  @Override
  public void start(Stage stage) {
    // Add event handlders to the buttons
    startBtn.setOnAction(e -> runTask());
    exitBtn.setOnAction(e -> stage.close());

    HBox buttonBox = new HBox(5, startBtn, exitBtn);
    VBox root = new VBox(10, statusLbl, buttonBox);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("An Unresponsive UI");
    stage.show();
  }
 @Override
 public void initialize(URL location, ResourceBundle resources) {
   nameInput.setPromptText("名字不能填空的撒");
   tagInput.setPromptText("多个标签用半角逗号隔开");
   saveBtn.setOnAction(
       (event) -> {
         savePro();
       });
   cancelBtn.setOnAction(
       (event) -> {
         cancel();
       });
 }
  public EasyEditShareView(
      Stage stage, OnToggleListener toggleListener, OnSetPatchListener setPatchListener) {
    this.stage = stage;
    this.toggleListener = toggleListener;
    this.effects = initEffects(stage.getScene().getRoot());

    this.title = (Text) stage.getScene().getRoot().lookup("#bank");

    this.next = (Button) stage.getScene().getRoot().lookup("#next");
    this.before = (Button) stage.getScene().getRoot().lookup("#before");

    next.setOnAction(event -> setPatchListener.next());
    before.setOnAction(event -> setPatchListener.before());
  }
Beispiel #30
0
  private static GridPane makeGridPane() {

    // all the widgets
    Text fText = new Text("Fahrenheit");
    Text cText = new Text("Celsius");
    TextField f = new TextField();
    TextField c = new TextField();
    Button f2c = new Button(">>>");
    Button c2f = new Button("<<<");

    GridPane gridPane = new GridPane();
    gridPane.add(fText, 0, 0);
    gridPane.add(f2c, 1, 0);
    gridPane.add(cText, 2, 0);
    gridPane.add(f, 0, 1);
    gridPane.add(c2f, 1, 1);
    gridPane.add(c, 2, 1);

    f.setPrefColumnCount(5);
    f.setPromptText("-40.0");
    c.setPrefColumnCount(5);
    c.setPromptText("-40.0");
    gridPane.setHgap(10);
    gridPane.setVgap(10);
    gridPane.setPadding(new Insets(10, 10, 10, 10));
    GridPane.setValignment(fText, VPos.BOTTOM);
    GridPane.setValignment(cText, VPos.BOTTOM);

    // event handling
    f2c.setOnAction(
        new EventHandler<ActionEvent>() {
          public void handle(ActionEvent e) {
            float fval = Float.valueOf(f.getText());
            float cval = (fval - 32) * 5 / 9;
            c.setText(String.format("%5.1f", cval));
          }
        });

    c2f.setOnAction(
        new EventHandler<ActionEvent>() {
          public void handle(ActionEvent e) {
            float cval = Float.valueOf(c.getText());
            float fval = cval * 9 / 5 + 32;
            f.setText(String.format("%5.1f", fval));
          }
        });

    return gridPane;
  }