Esempio n. 1
0
  public WorkSpaceTabVC(Stage s) {
    myWorkSpaces = new ArrayList<UserInterfaceVC>();

    myTabPane = new TabPane();
    myStage = s;
    myGroup = new Group();
    myScene = new Scene(myGroup, SIZE, SIZE);

    myBorderPane = new BorderPane();
    myBorderPane.prefWidthProperty().bind(myScene.widthProperty());
    myBorderPane.prefHeightProperty().bind(myScene.heightProperty());

    myMenuBar = makeMenuBar();
    addAndDisplayTabs();
  }
Esempio n. 2
0
  @Override
  protected void initTitle() {
    oneClick.addListener(
        (observable, oldValue, newValue) ->
            GlobalCachedExecutorService.submit(
                new Task() {
                  @Override
                  protected Object call() {
                    if (toggleSwitch.isSelected()) {
                      sendStateToRemote(ActivationState.State.DEACTIVE);
                    } else {
                      sendStateToRemote(ActivationState.State.ACTIVE);
                    }
                    return null;
                  }
                }));

    toggleSwitch.setOnMouseClicked(
        event ->
            GlobalCachedExecutorService.submit(
                new Task() {
                  @Override
                  protected Object call() {
                    if (toggleSwitch.isSelected()) {
                      sendStateToRemote(ActivationState.State.ACTIVE);
                    } else {
                      sendStateToRemote(ActivationState.State.DEACTIVE);
                    }
                    return null;
                  }
                }));

    unknownForegroundIcon.setForegroundIconColor(Color.BLUE);
    unknownBackgroundIcon.setForegroundIconColor(Color.WHITE);

    headContent.setCenter(getUnitLabel());
    headContent.setAlignment(getUnitLabel(), Pos.CENTER_LEFT);
    headContent.prefHeightProperty().set(appIcon.getHeight() + Constants.INSETS);
  }
Esempio n. 3
0
  @Override
  public void start(Stage primaryStage) {
    primaryStage.setTitle("Chapter 15-16 Adding Tabs to a UI");
    Group root = new Group();
    Scene scene = new Scene(root, 400, 250, Color.WHITE);

    TabPane tabPane = new TabPane();

    MenuBar menuBar = new MenuBar();

    EventHandler<ActionEvent> action = changeTabPlacement(tabPane);

    Menu menu = new Menu("Tab Side");
    MenuItem left = new MenuItem("Left");

    left.setOnAction(action);
    menu.getItems().add(left);

    MenuItem right = new MenuItem("Right");
    right.setOnAction(action);
    menu.getItems().add(right);

    MenuItem top = new MenuItem("Top");
    top.setOnAction(action);
    menu.getItems().add(top);

    MenuItem bottom = new MenuItem("Bottom");
    bottom.setOnAction(action);
    menu.getItems().add(bottom);

    menuBar.getMenus().add(menu);

    BorderPane borderPane = new BorderPane();

    // generate 10 tabs
    for (int i = 0; i < 10; i++) {
      Tab tab = new Tab();
      tab.setText("Tab" + i);
      HBox hbox = new HBox();
      hbox.getChildren().add(new Label("Tab" + i));
      hbox.setAlignment(Pos.CENTER);
      tab.setContent(hbox);
      tabPane.getTabs().add(tab);
    }

    // add tab pane
    borderPane.setCenter(tabPane);

    // bind to take available space
    borderPane.prefHeightProperty().bind(scene.heightProperty());
    borderPane.prefWidthProperty().bind(scene.widthProperty());

    // added menu bar
    borderPane.setTop(menuBar);

    // add border Pane
    root.getChildren().add(borderPane);

    primaryStage.setScene(scene);
    primaryStage.show();
  }