コード例 #1
0
    public ResizeListener(final Stage stage, final BorderPane menu) {
      this.stage = stage;
      this.menu = menu;

      menu.setOnMouseDragged(
          new EventHandler<MouseEvent>() {
            @Override
            public void handle(final MouseEvent mouseEvent) {
              if (!ResizeListener.this.resizing) {
                stage.setX(mouseEvent.getScreenX() + ResizeListener.this.dragDeltax);
                stage.setY(mouseEvent.getScreenY() + ResizeListener.this.dragDeltay);
              }
            }
          });

      menu.setOnMousePressed(
          new EventHandler<MouseEvent>() {
            @Override
            public void handle(final MouseEvent mouseEvent) {
              // record a delta distance for the drag and drop operation.
              ResizeListener.this.resizing = false;
              ResizeListener.this.dragDeltax = stage.getX() - mouseEvent.getScreenX();
              ResizeListener.this.dragDeltay = stage.getY() - mouseEvent.getScreenY();
            }
          });
    }
コード例 #2
0
ファイル: MainClass.java プロジェクト: rutvikpatel29/JavaFX
  @Override
  public void start(Stage primaryStage) throws Exception {
    window = primaryStage;
    window.setTitle("The Title");

    // Edit menu
    Menu difficultyMenu = new Menu("Difficulty");

    ToggleGroup group = new ToggleGroup();
    RadioMenuItem easy = new RadioMenuItem("Easy");
    RadioMenuItem medium = new RadioMenuItem("Medium");
    RadioMenuItem hard = new RadioMenuItem("Hard");

    easy.setToggleGroup(group);
    medium.setToggleGroup(group);
    hard.setToggleGroup(group);

    hard.setSelected(false);
    hard.setOnAction(
        e -> {
          System.out.println("You selected hard");
        });

    difficultyMenu.getItems().addAll(easy, medium, hard);

    MenuBar menuBar = new MenuBar();
    menuBar.getMenus().addAll(difficultyMenu);

    BorderPane layout = new BorderPane();
    layout.setTop(menuBar);

    Scene scene = new Scene(layout, 500, 400);
    window.setScene(scene);
    window.show();
  }
コード例 #3
0
ファイル: WebKitBrowser.java プロジェクト: sumitlakra/BurpKit
  private void createMasterPane() {
    webView = new WebView();

    webViewAnchorPane = new AnchorPane(webView);
    AnchorPane.setBottomAnchor(webView, 0.0);
    AnchorPane.setTopAnchor(webView, 0.0);
    AnchorPane.setLeftAnchor(webView, 0.0);
    AnchorPane.setRightAnchor(webView, 0.0);

    webEngine = webView.getEngine();

    dialog = Dialogs.create().lightweight().modal().owner(webView);

    //        locals = new LocalJSObject(webEngine);
    //        globals = GlobalJSObject.getGlobalJSObject(webEngine);
    javaScriptHelpers = new BurpKitBridge(webEngine);
    originalUserAgent = webEngine.getUserAgent();
    webEngine.setJavaScriptEnabled(true);
    webEngine.setOnAlert(this::handleAlert);
    webEngine.setOnError(this::handleError);
    webEngine.setConfirmHandler(param -> true);
    webEngine.getLoadWorker().stateProperty().addListener(this::workerStateChanged);

    createToolBar();

    createStatusBar();

    webEngine.load("about:blank");

    masterPane = new BorderPane();
    masterPane.setTop(toolBar);
    masterPane.setCenter(webViewAnchorPane);
    masterPane.setBottom(statusBar);
  }
コード例 #4
0
  @Override
  public void start(Stage stage) throws Exception {

    stage.setTitle("Script Creator");

    // Center
    events = new VBox();
    eventsScrollPane = new ScrollPane();
    eventsScrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
    eventsScrollPane.setContent(events);

    // Left
    VBox left = new VBox();
    Button record = new Button("Record"), add = new Button("Add");
    CheckBox recordWheel = new CheckBox("Wheel"),
        recordMouseMovements = new CheckBox("Movement"),
        recordTime = new CheckBox("Time");
    add.setOnAction(e -> events.getChildren().add(new EditableLabel()));
    left.getChildren().addAll(add, record, recordWheel, recordTime, recordMouseMovements);

    // Bottom

    // Container
    BorderPane mainLayout = new BorderPane();
    mainLayout.setCenter(eventsScrollPane);
    mainLayout.setLeft(left);

    main = new Scene(mainLayout, 300, 250);
    stage.setScene(main);

    stage.show();
  }
コード例 #5
0
ファイル: ServerFX.java プロジェクト: g00291875/FYP-Server
  @Override
  public void start(Stage primaryStage) throws Exception {
    BorderPane root = new BorderPane();
    HBox message = new HBox();

    userText = new TextField();
    userText.setEditable(false);
    userText.setOnAction(
        e -> {
          sendMessage(e.getEventType().toString());
          userText.setText("");
        });

    message.getChildren().add(userText);
    message.setAlignment(Pos.CENTER);
    message.setPadding(new Insets(10));

    chatWindow = new TextArea();
    chatWindow.setPrefSize(300, 150);
    chatWindow.setVisible(true);

    root.setCenter(chatWindow);
    root.setBottom(message);

    startRunning();
    primaryStage.setTitle("Instant Messenger");
    primaryStage.setScene(new Scene(root, 300, 275));
    primaryStage.show();
  }
コード例 #6
0
  @Override
  protected BorderPane getPane() {

    BorderPane pane = new BorderPane();
    GridPane paneFullTime = new GridPane();

    paneFullTime.setAlignment(Pos.CENTER);
    paneFullTime.setPadding(new Insets(11, 12, 13, 14));
    paneFullTime.setHgap(5.5);
    paneFullTime.setVgap(5.5);

    paneFullTime.add(text, 0, 0);
    paneFullTime.add(tfSSN, 1, 0);

    paneFullTime.add(arrNonCreditChBox[0], 0, 2);
    paneFullTime.add(arrNonCreditChBox[1], 0, 3);
    paneFullTime.add(arrNonCreditChBox[2], 0, 4);
    paneFullTime.add(submitBt, 1, 5);

    pane.setCenter(paneFullTime);

    submitBt.setOnAction(
        e -> {
          checkingRequirements();
          connectToDB();
          submitToDB();
          pane.setCenter(new Congratulation().getPane());
        });
    return pane;
  }
コード例 #7
0
  /** @param fp */
  private void makeDialog(FlowPane fp) {

    Separator sp = new Separator();

    // LOGO
    logoChildBP.setCenter(logo);

    // LBL TXT
    lblText = new Text(LBLTXT);
    Font mFont = Font.font("Dialog", FontPosture.ITALIC, 0xf);
    lblText.setFont(mFont);
    lblText.setFill(Color.BLUEVIOLET);
    lblText.setWrappingWidth(0x12c);
    labelChildBP.setCenter(lblText);

    // ----------------------------------------------------------------------
    addItems(fp);
    // ----------------------------------------------------------------------
    this.addButt = new Button("ADD NEW");
    this.addButt.setDefaultButton(true);
    this.addButt.setAlignment(Pos.TOP_RIGHT);
    this.addButt.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent t) {
            addNewItemsDialog();
            primaryStage.close();
          }
        });
    fp.getChildren().add(addButt);
  }
コード例 #8
0
ファイル: TelaAux.java プロジェクト: diogenesfilho/sgong
  public TelaAux(String mensagem) {
    this.mensagem = mensagem;

    BorderPane root = new BorderPane();
    Scene scene = new Scene(root, 450, 80, Color.LIGHTGRAY);

    VBox boxtexto = new VBox(10);

    Label texto = new Label(getMensagem());
    Button ok = new Button("OK");
    ok.setStyle("-fx-cursor: hand;");

    boxtexto.getChildren().addAll(texto, ok);
    boxtexto.setAlignment(Pos.CENTER);

    root.setCenter(boxtexto);
    texto.setFont(new Font(15));
    setScene(scene);
    setOpacity(0.9);
    initModality(
        Modality.APPLICATION_MODAL); // Responsável por só ser possível voltar ao sg ong se fechar a
    // janela.
    show();

    ok.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent arg0) {
            close();
          }
        });
  }
コード例 #9
0
ファイル: WelcomePart.java プロジェクト: DawnScience/dawn-ui
  @Override
  public void createPartControl(Composite container) {

    Platform.setImplicitExit(false); // Keep the JavaFX thread running

    // Creating a JavaFX Browser, so create an FXCanvas to contain it
    FXCanvas canvas = new FXCanvas(container, SWT.NONE);
    BorderPane borderPane = new BorderPane();
    Scene scene = new Scene(borderPane);

    WebView browser = new WebView();
    webEngine = browser.getEngine();
    webEngine.load(homeLocation);

    borderPane.setCenter(browser);

    canvas.setScene(scene);

    IActionBars actionBars = getIntroSite().getActionBars();
    IToolBarManager toolBar = actionBars.getToolBarManager();

    setupToolbarButtons(toolBar);
    lockUrl();
    addJSBridges();
  }
コード例 #10
0
 private void initializeCeiling(BorderPane root) {
   ceiling = new Ellipse();
   ceiling.centerXProperty().bind(root.widthProperty().multiply(0.35));
   ceiling.centerYProperty().bind(root.heightProperty().multiply(0.1));
   ceiling.radiusXProperty().bind(root.widthProperty().multiply(0.5));
   ceiling.radiusYProperty().bind(root.heightProperty().multiply(0.25));
 }
コード例 #11
0
  public Pane buildArtifactPropertiesLayout(
      PackageArtifact artifact,
      Map<String, PackageDescriptionViewImpl.ArtifactPropertyContainer> artifactPropertyFields,
      Set<PackageDescriptionViewImpl.ArtifactRelationshipContainer> artifactRelationshipFields,
      Map<String, CheckBox> metadataInheritanceButtonMap,
      PackageDescriptionPresenter packageDescriptionPresenter,
      PackageOntologyService packageOntologyService) {

    this.artifactPropertyFields = artifactPropertyFields;
    this.artifactRelationshipFields = artifactRelationshipFields;

    artifactDetailsLayout = new BorderPane();
    artifactDetailsLayout.setMinHeight(500);
    artifactDetailsLayout.setMinWidth(540);

    artifactDetailsLayout.getStylesheets().add("/css/app.css");
    artifactDetailsLayout.getStyleClass().add(PACKAGE_TOOL_POPUP_CLASS);

    this.metadataInheritanceButtonMap = metadataInheritanceButtonMap;
    this.presenter = packageDescriptionPresenter;
    this.packageOntologyService = packageOntologyService;

    createArtifactDetailsPopup(artifact);

    return artifactDetailsLayout;
  }
コード例 #12
0
  private Scene createMainTetrisScene() {
    mainPane = new BorderPane();

    VBox mainBox = new VBox();
    mainBox.setPadding(new Insets(200, 0, 0, 20));
    mainBox.getChildren().add(mainGrid);
    mainGrid.setOnKeyPressed(new KeyboardHandler());

    mainPane.setBottom(mainBox);
    mainPane.setTop(createActionPane());
    mainPane.setRight(createStatePane());

    Group group = new Group();
    for (int i = 19; i >= 0; i--) {
      for (int j = 0; j < 10; j++) {
        Image img;
        if (mainGrid.getColor(i, j) != Color.DARKGRAY) {
          img = new Image(getClass().getResourceAsStream("RED.png"));
        } else {
          img = new Image(getClass().getResourceAsStream("EMPTY.png"));
        }
        ImageView iView = new ImageView(img);
        iView.setX(j * 17);
        iView.setY(i * 16);
        iView.setOpacity(1);
        iView.setPreserveRatio(true);
        group.getChildren().addAll(iView);
      }
    }
    Scene scene = new Scene(group, 600, 600);
    mainPane.setCenter(group);

    return new Scene(mainPane, 380, 540); // 540
  }
コード例 #13
0
  /** DEFAULT. */
  public CafePricingDialog() {
    this.priceMap = new HashMap<>();
    this.primaryStage = new Stage();
    this.root = new Group();
    this.scrollPane = new ScrollPane();
    this.scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    this.scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    this.scene = new Scene(scrollPane, 0x190, 0x1f4, Color.LIGHTGREY);

    makeDialog(fp);

    fp.setMinSize(380, 480);
    fp.setAlignment(Pos.TOP_CENTER);

    bp.setTop(logoChildBP);
    bp.setCenter(labelChildBP);
    bp.setBottom(fp);

    root.getChildren().add(bp);

    scrollPane.setContent(root);

    // --------------------------------------------
    this.primaryStage.setTitle(TITLE);
    this.primaryStage.setScene(scene);
    this.primaryStage.setResizable(false);
    this.primaryStage.show();
  }
コード例 #14
0
  /**
   * Sets up the OverlayMenu with all buttons from the existing table view.
   *
   * @param tableView The table view to put on the overlay menu.
   * @return A {@link BorderPane} containing the full menu.
   */
  private BorderPane setUpMenu(TableView<FilterInput> tableView) {

    final Button addButton = setAddButton();
    final Button removeButton = setRemoveButton(tableView);
    final Button editButton = setEditButton(tableView);
    final Button selectionButton = setSelectionButton();

    // Set up components on overlay
    final BorderPane borderPane = new BorderPane();
    borderPane.setCenter(tableView);
    tableView.setMinHeight(300);

    AnchorPane anchorPane = new AnchorPane();
    anchorPane.getChildren().addAll(addButton, removeButton, editButton, selectionButton);
    borderPane.setBottom(anchorPane);

    AnchorPane.setBottomAnchor(addButton, 0d);
    AnchorPane.setRightAnchor(addButton, 0d);
    AnchorPane.setBottomAnchor(removeButton, 0d);
    AnchorPane.setRightAnchor(removeButton, 30d);
    AnchorPane.setBottomAnchor(editButton, 0d);
    AnchorPane.setRightAnchor(editButton, 60d);
    AnchorPane.setBottomAnchor(selectionButton, 0d);
    AnchorPane.setRightAnchor(selectionButton, 95d);

    return borderPane;
  }
コード例 #15
0
  public RNADrawingView() {

    // set up gui
    drawingPane.setPrefWidth(400);
    drawingPane.setPrefHeight(400);
    warningLabel.setTextFill(Color.RED);
    animateCheckbox.setSelected(false);

    buttonBox.getChildren().addAll(foldButton, drawButton, animateCheckbox);
    inputBox.getChildren().addAll(sequenceField, bracketField, buttonBox);
    buttonInputBox.getChildren().addAll(inputBox, warningLabel, buttonBox);
    drawingPane.getChildren().add(drawing);
    root.setTop(buttonInputBox);
    root.setBottom(drawingPane);

    buttonBox.setAlignment(Pos.BOTTOM_LEFT);
    inputBox.setPadding(new Insets(10, 5, 10, 5));
    HBox.setMargin(foldButton, new Insets(0, 2.5, 0, 2.5));
    HBox.setMargin(drawButton, new Insets(0, 2.5, 0, 2.5));
    HBox.setMargin(animateCheckbox, new Insets(0, 2.5, 0, 2.5));
    VBox.setMargin(sequenceField, new Insets(0, 0, 5, 0));

    this.scene = new Scene(root);
    scene.getStylesheets().add("resources/assignment6and7.css");
    drawingPane.getStyleClass().add("drawingPane");
  }
コード例 #16
0
  public MainScreenView(final MainScreenController controller) {
    // Setup Job  List:
    listView_jobs.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    // Setup output area:
    textArea_output.setEditable(false);
    textArea_output.setFocusTraversable(false);

    // Set Component Tooltips:
    button_createJob.setTooltip(new Tooltip("Open the Job creation dialog to create a new Job."));
    button_deleteSelectedJobs.setTooltip(
        new Tooltip("Removes all Jobs that are currently selected on the list."));
    button_deleteAllJobs.setTooltip(new Tooltip("Clears the list of all Jobs."));
    button_clearOutput.setTooltip(new Tooltip("Clears the output screen."));
    button_editSettings.setTooltip(new Tooltip("Open the settings menu."));
    button_encode.setTooltip(new Tooltip("Encodes the selected handler(s)."));
    button_decode.setTooltip(
        new Tooltip(
            "Decodes the selected handler(s).\n\n"
                + "No checking is done to see if the files have ever been encoded,\n"
                + "so it's up to you to ensure you're decoding the correct files."));

    // Set Component EventHandlers:
    button_createJob.setOnAction(controller);
    button_encode.setOnAction(controller);
    button_decode.setOnAction(controller);
    button_deleteSelectedJobs.setOnAction(controller);
    button_deleteAllJobs.setOnAction(controller);
    button_clearOutput.setOnAction(controller);
    button_editSettings.setOnAction(controller);

    // Setup the Layout:
    final HBox panel_left_top = new HBox(10);
    panel_left_top.setAlignment(Pos.CENTER);
    panel_left_top
        .getChildren()
        .addAll(button_createJob, button_deleteSelectedJobs, button_deleteAllJobs);

    final HBox panel_left_bottom = new HBox(10);
    panel_left_bottom.setAlignment(Pos.CENTER);
    panel_left_bottom.getChildren().addAll(button_encode, button_decode);

    final VBox panel_left = new VBox(4);
    HBox.setHgrow(panel_left, Priority.ALWAYS);
    VBox.setVgrow(listView_jobs, Priority.ALWAYS);
    panel_left.getChildren().addAll(panel_left_top, listView_jobs, panel_left_bottom);

    final BorderPane panel_right_bottom = new BorderPane();
    panel_right_bottom.setLeft(button_clearOutput);
    panel_right_bottom.setRight(button_editSettings);

    final VBox panel_right = new VBox(4);
    HBox.setHgrow(panel_right, Priority.ALWAYS);
    VBox.setVgrow(textArea_output, Priority.ALWAYS);
    panel_right.getChildren().addAll(textArea_output, panel_right_bottom);

    this.setSpacing(4);
    this.getChildren().addAll(panel_left, panel_right);
  }
コード例 #17
0
ファイル: CollectorGui.java プロジェクト: MattPfenn/Java_work
  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());
  }
コード例 #18
0
  @FXML
  private void HandleTableButtonAction(ActionEvent event) throws IOException {
    // Create the custom dialog.
    Dialog<Pair<ObservableList, ObservableList<ZRow>>> dialog = new Dialog<>();
    dialog.setTitle("Editeur de tableau");
    dialog.setHeaderText("");

    // Set the icon (must be included in the project).
    dialog.setGraphic(
        new ImageView(MainApp.class.getResource("assets/static/icons/table.png").toString()));

    // Set the button types.
    dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);

    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(MainApp.class.getResource("fxml/TableEditor.fxml"));
    BorderPane tableEditor = loader.load();
    TableView<ZRow> tbView = (TableView) tableEditor.getCenter();

    TableController controller = loader.getController();
    controller.setEditor(this);

    dialog.getDialogPane().setContent(tableEditor);

    dialog.setResultConverter(
        dialogButton -> {
          if (dialogButton == ButtonType.OK) {
            return new Pair<>(tbView.getColumns(), tbView.getItems());
          }
          return null;
        });

    Optional<Pair<ObservableList, ObservableList<ZRow>>> result = dialog.showAndWait();

    result.ifPresent(
        datas -> {
          String[][] data =
              new String[datas.getValue().size()][datas.getValue().get(0).getRow().size()];
          String[] headers = new String[datas.getKey().size()];
          int cpt = 0;
          for (Object key : datas.getKey()) {
            headers[cpt] = ((TextField) ((TableColumn) key).getGraphic()).getText();
            cpt++;
          }

          for (int i = 0; i < datas.getValue().size(); i++) {
            for (int j = 0; j < datas.getValue().get(i).getRow().size(); j++) {
              data[i][j] = datas.getValue().get(i).getRow().get(j);
            }
          }
          String tablestring = FlipTable.of(headers, data);
          SourceText.replaceText(SourceText.getSelection(), "\n\n" + tablestring + "\n\n");
          SourceText.requestFocus();
        });
  }
コード例 #19
0
 public FxScrollPreview() {
   titleDisplay = new TextField("");
   titleDisplay.setEditable(false);
   titleDisplay.getStyleClass().add("scroll-title");
   content = new WebView();
   content.getStyleClass().add("scroll-preview-browser");
   pane = new BorderPane();
   pane.getStyleClass().add("scroll-preview-pane");
   pane.setTop(titleDisplay);
   pane.setCenter(content);
 }
コード例 #20
0
  public static Node createProgressIndicator() {
    ProgressIndicator indicator = new ProgressIndicator();
    indicator.setMaxHeight(350);
    indicator.setMaxWidth(350);

    BorderPane borderPane = new BorderPane();
    BorderPane.setMargin(indicator, new Insets(5));
    borderPane.setCenter(indicator);
    borderPane.setStyle("-fx-background-color: rgba(230,230,230,0.7);");
    return borderPane;
  }
コード例 #21
0
  private BorderPane initStatusBar() {
    BorderPane pane = new BorderPane();
    pane.setPadding(new Insets(5));

    logLabel = new Label();
    logLabel.setTextFill(Color.WHITE);
    statusLabel.setTextFill(Color.WHITE);
    pane.setLeft(logLabel);
    pane.setRight(statusLabel);

    return pane;
  }
コード例 #22
0
  @Override
  public void start(Stage stage) throws Exception {
    game = GameImpl.INSTANCE;

    LocalEndpoint.client = this;

    final BorderPane root = new BorderPane();
    root.setStyle("-fx-padding: 20");
    //		root.setCenter(rows);

    Timeline fiveSecondsWonder =
        new Timeline(
            new KeyFrame(
                Duration.seconds(1),
                new EventHandler<ActionEvent>() {

                  @Override
                  public void handle(ActionEvent event) {

                    final Sprite[][] grille = game.getGrille();
                    // *
                    //						final Sprite[][] grille = new Sprite[][] {
                    //								{ Sprite.MUR, Sprite.SOL, Sprite.FANTOME },
                    //								{ Sprite.MUR, Sprite.SOL, Sprite.FANTOME },
                    //								{ Sprite.MUR, Sprite.SOL, Sprite.FANTOME } };
                    // */
                    if (grille.length == 0) {
                      System.out.println("Grille vide");
                    } else {
                      System.out.println(
                          "Grille de taille : (" + grille.length + " x " + grille[0].length + ")");
                    }
                    VBox rows = prepareBoard(grille);

                    root.setCenter(rows);
                  }
                }));
    fiveSecondsWonder.setCycleCount(Timeline.INDEFINITE);
    fiveSecondsWonder.play();

    Scene scene = new Scene(root);
    scene.setOnKeyPressed(
        new EventHandler<KeyEvent>() {
          @Override
          public void handle(KeyEvent event) {
            System.out.println(
                "AmiEnnemisClient.start(...).new EventHandler() {...}.handle()" + event.getCode());
            doMove(event);
          }
        });
    stage.setScene(scene);
    stage.show();
  }
コード例 #23
0
ファイル: InventoryView.java プロジェクト: rwcarlsen/cyclist2
  private void build() {
    setTitle(TITLE);
    getStyleClass().add("inventory");

    setupActions();

    BorderPane pane = new BorderPane();
    pane.setCenter(_chart); // buildChart());
    pane.setLeft(buildCtrl());

    setContent(pane);
  }
コード例 #24
0
  @Override
  public void start(Stage stage) throws Exception {
    Point[] sample =
        new Point[] {
          new Point(20, 10), new Point(50, 50),
          new Point(10, 20), new Point(100, 30),
          new Point(100, 200), new Point(30, 30),
        };

    ArrayList<Point> result = convexHull(sample);
    System.out.println("Left with: " + result.toString());

    // for animated spawning of dots
    Circle[] sampleDots = new Circle[sample.length];
    for (int i = 0; i < sampleDots.length; i++) {
      sampleDots[i] = new Circle(sample[i].x, sample[i].y, 3);
      sampleDots[i].setFill(Color.RED);
      sampleDots[i].opacityProperty().set(0);
      if (result.contains(sample[i])) sampleDots[i].setFill(Color.DARKCYAN);
      bp.getChildren().add(sampleDots[i]);
      sampleDots[i].toFront();
    }

    // polygon of result
    Polygon p = new Polygon();
    p.setFill(Color.TRANSPARENT);
    p.setStroke(Color.BLACK);
    p.setStrokeWidth(3);
    for (Point pt : result) {
      p.getPoints().addAll(Double.valueOf(pt.x), Double.valueOf(pt.y));
    }
    bp.getChildren().add(p);

    // scene & stage related
    Scene scene = new Scene(bp, 250, 250);
    stage.setScene(scene);
    stage.setResizable(false);
    stage.setTitle("Sample Convex Hull");
    stage.show();

    // animated spawning of dots
    p.toBack();
    Timeline tl = new Timeline();
    for (int i = 0; i < sampleDots.length; i++) {
      tl.getKeyFrames()
          .add(
              new KeyFrame(
                  Duration.seconds(1), new KeyValue(sampleDots[i].opacityProperty(), 1.0)));
    }
    tl.setCycleCount(1);
    tl.play();
  }
コード例 #25
0
  public SubExperimentListCell() {
    BorderPane.setMargin(progressRect, new Insets(2));
    BorderPane.setMargin(progressRect, new Insets(2, 0, 0, 0));
    BorderPane.setAlignment(label, Pos.BOTTOM_LEFT);

    progressRect.setMaxWidth(Integer.MAX_VALUE);
    progressRect.setPrefHeight(3);
    progressRect.setMinHeight(3);
    progressRect.getStyleClass().add("mini-progress-bar");

    content.setBottom(progressRect);
    content.setCenter(label);
  }
コード例 #26
0
ファイル: LoginUI.java プロジェクト: nus-mtp/x-aurora
  public Scene createLoginScene() {
    BorderPane borderPane = new BorderPane();
    HBox title = createTitle();
    GridPane grid = createLoginForm(borderPane);
    HBox hbox = createSkipLoginBar();

    borderPane.setTop(title);
    borderPane.setCenter(grid);
    borderPane.setBottom(hbox);

    Scene scene = new Scene(borderPane, sceneWidth, sceneHeight);
    return scene;
  }
コード例 #27
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    BorderPane outerPane = new BorderPane();
    HBox topBox = new HBox(20);
    HBox bottomBox = new HBox(20);
    outerPane.setCenter(newText);

    fontChoice.setValue("Times New Roman");
    sizeChoice.setValue(12);

    topBox.setPadding(new Insets(20, 20, 20, 20));
    bottomBox.setPadding(new Insets(20, 20, 20, 20));

    List<String> items = Font.getFamilies();
    fontChoice.getItems().addAll(items);

    for (int i = 1; i <= 100; i++) sizeChoice.getItems().add(i);

    topBox.getChildren().addAll(fontName, fontChoice, fontSize, sizeChoice);
    bottomBox.getChildren().addAll(bold, italic);
    topBox.setAlignment(Pos.CENTER);
    bottomBox.setAlignment(Pos.CENTER);

    outerPane.setTop(topBox);
    outerPane.setCenter(newText);
    outerPane.setBottom(bottomBox);

    fontChoice.setOnAction(
        e -> {
          setFont();
        });

    sizeChoice.setOnAction(
        e -> {
          setFont();
        });

    bold.setOnAction(
        e -> {
          setFont();
        });
    italic.setOnAction(
        e -> {
          setFont();
        });

    Scene scene = new Scene(outerPane, X, Y);
    primaryStage.setScene(scene);
    primaryStage.show();
  }
コード例 #28
0
ファイル: FormTUController.java プロジェクト: naduda/PowerSys
  public boolean isOkPressed(int typeSignal) {
    ((StageLoader) btnOK.getScene().getWindow()).setMethod(() -> btnOK());
    if (tuSignal == null) return false;
    Stage w = (Stage) btnOK.getScene().getWindow();

    if (typeSignal == 3) {
      List<SpTuCommand> tuCommands =
          SingleFromDB.spTuCommands
              .stream()
              .filter(f -> f.getObjref() == tuSignal.getStateref())
              .collect(Collectors.toList());
      ChoiceBox<SpTuCommand> chBox = new ChoiceBox<>();
      tuCommands.forEach(chBox.getItems()::add);
      chBox
          .getSelectionModel()
          .selectedItemProperty()
          .addListener(
              (observ, oldValue, newValue) -> {
                value = newValue.getVal() + "";
              });
      if (chBox.getItems().size() > 0) chBox.getSelectionModel().selectFirst();
      if (SingleObject.selectedShape.getValueProp().get()
          == chBox.getSelectionModel().getSelectedItem().getVal()) {
        chBox.getSelectionModel().selectNext();
      }
      Platform.runLater(() -> chBox.requestFocus());
      bpTU.setCenter(chBox);
    } else if (typeSignal == 1) {
      TextField txtField = new TextField();
      txtField.setText(SingleObject.selectedShape.getValueProp().get() + "");
      txtField
          .textProperty()
          .addListener(
              (observ, oldValue, newValue) -> {
                try {
                  Double.parseDouble(newValue);
                  value = newValue;
                } catch (Exception e) {
                  txtField.setText(oldValue);
                }
              });
      Platform.runLater(() -> txtField.requestFocus());
      bpTU.setCenter(txtField);
    } else {
      System.out.println("=====   This is not TU or TI   =====");
    }
    w.showAndWait();

    return isOkClicked;
  }
コード例 #29
0
  /** Creates the album playback view. */
  private void display() {
    scrollPos = 0;

    songScroller = new ScrollPane();
    songScroller.setMinWidth(PaneUtil.WIDTH - GoogleUINaviController.COVER_SIZE - 10);
    songScroller.setStyle("-fx-background-color:transparent;");
    songScroller.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);

    songBox = new VBox(6);
    songBox.setPadding(new Insets(3, 2, 2, 2));
    int track = 1;
    for (Song song : album.getSongs()) {
      HBox trackBox = new HBox();

      trackBox.setId(String.valueOf(song.getMID()));
      trackBox.setAlignment(Pos.BASELINE_LEFT);
      trackBox.setPadding(new Insets(2, 5, 2, 5));
      if (track == 1) {
        trackBox.setStyle(STYLE_ACTIVE);
        lastSongSelection = trackBox;
      } else {
        trackBox.setStyle(STYLE_INACTIVE);
      }

      BorderPane innerTrackBox = new BorderPane();
      HBox posBox = new HBox(5);
      posBox.setMinWidth(40);
      posBox.getChildren().add(createTrackText(track + "."));
      innerTrackBox.setLeft(posBox);
      HBox nameBox = new HBox(5);
      nameBox.setMinWidth(385);

      String name = song.getName();
      if (name.endsWith(".mp3")) {
        name = name.substring(0, name.length() - 4);
      }
      nameBox.getChildren().add(createTrackText(" " + name));
      innerTrackBox.setCenter(nameBox);
      innerTrackBox.setRight(createTrackText(song.getDuration()));

      trackBox.getChildren().add(innerTrackBox);
      songBox.getChildren().add(trackBox);

      track++;
    }

    songScroller.setOpacity(0);
    songScroller.setContent(songBox);
    albumNode.getChildren().add(songScroller);
  }
コード例 #30
0
ファイル: MainView.java プロジェクト: BrunoMatry/cloudbook
 /**
  * Add a radio button corresponding to the save of name name
  *
  * @param name name of the corresponding save file
  */
 private void setUpRegistry(final Engine engine) {
   String name = engine.getNode().nameProperty().get();
   BorderPane registry = new BorderPane();
   HBox box = new HBox();
   Network network = (Network) engine.getNetwork();
   ConnectionButton connectionState = new ConnectionButton(network);
   Button launcher = new LoadNode(name);
   box.getChildren().addAll(connectionState, launcher);
   Button deleter = new DeleteNode(name);
   registry.setLeft(box);
   registry.setRight(deleter);
   registry.setStyle("-fx-background-color: white;");
   registries.add(registry);
 }