Java Code Examples for javafx.scene.layout.HBox#setId()

The following examples show how to use javafx.scene.layout.HBox#setId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatisticsView.java    From Maus with GNU General Public License v3.0 6 votes vote down vote up
BorderPane getStatisticsView() {
    statisticsView.getStylesheets().add(getClass().getResource("/css/global.css").toExternalForm());
    HBox systemPanel = getSystemPanel();
    systemPanel.setId("statisticsView");
    systemPanel.setPadding(new Insets(0, 0, 0, 10));

    HBox statPanel = new HBox();
    statPanel.setId("statisticsView");
    statPanel.setPadding(new Insets(0, 0, 0, 10));

    statisticsView.setTop(new TopBar().getTopBar(Maus.getPrimaryStage()));
    statisticsView.setLeft(systemPanel);
    statisticsView.setCenter(statPanel);
    statisticsView.setBottom(new BottomBar().getBottomBar());
    return statisticsView;
}
 
Example 2
Source File: LocalRepositoryDetailsPanel.java    From phoenicis with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Populates the repository details step for the local repository
 */
private void populate() {
    this.pathField = new TextField();

    this.openBrowser = new Button(tr("Choose Directory..."));
    openBrowser.setOnAction(event -> {
        DirectoryChooser chooser = new DirectoryChooser();

        File directory = chooser.showDialog(null);

        pathField.setText(directory.toString());
    });

    HBox content = new HBox(pathField, openBrowser);
    content.setId("addLocalRepository");
    HBox.setHgrow(pathField, Priority.ALWAYS);

    this.setCenter(content);
}
 
Example 3
Source File: DataViewerSample.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
private static Pane getDemoPane() {
    final Rectangle rect = new Rectangle(-130, -40, 80, 80);
    rect.setFill(Color.BLUE);
    final Circle circle = new Circle(0, 0, 40);
    circle.setFill(Color.GREEN);
    final Polygon triangle = new Polygon(60, -40, 120, 0, 50, 40);
    triangle.setFill(Color.RED);

    final Group group = new Group(rect, circle, triangle);
    group.setTranslateX(300);
    group.setTranslateY(200);

    final RotateTransition rotateTransition = new RotateTransition(Duration.millis(4000), group);
    rotateTransition.setByAngle(3.0 * 360);
    rotateTransition.setCycleCount(Animation.INDEFINITE);
    rotateTransition.setAutoReverse(true);
    rotateTransition.play();

    final RotateTransition rotateTransition1 = new RotateTransition(Duration.millis(1000), rect);
    rotateTransition1.setByAngle(360);
    rotateTransition1.setCycleCount(Animation.INDEFINITE);
    rotateTransition1.setAutoReverse(false);
    rotateTransition1.play();

    final RotateTransition rotateTransition2 = new RotateTransition(Duration.millis(1000), triangle);
    rotateTransition2.setByAngle(360);
    rotateTransition2.setCycleCount(Animation.INDEFINITE);
    rotateTransition2.setAutoReverse(false);
    rotateTransition2.play();
    group.setManaged(true);

    HBox.setHgrow(group, Priority.ALWAYS);
    final HBox box = new HBox(group);
    VBox.setVgrow(box, Priority.ALWAYS);
    box.setId("demoPane");
    return box;
}
 
Example 4
Source File: ToolbarView.java    From WorkbenchFX with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void initializeParts() {
  topBox = new HBox();
  topBox.setId("top-box");

  toolbarControl = new ToolbarControl();
  toolbarControl.setId("toolbar-control");

  bottomBox = new HBox();
  bottomBox.setId("bottom-box");

  addIconShape = new StackPane();
  addIconShape.getStyleClass().add("shape");
  addModuleBtn = new Button("", addIconShape);
  addModuleBtn.getStyleClass().add("icon");
  addModuleBtn.setId("add-button");

  menuIconShape = new StackPane();
  menuIconShape.getStyleClass().add("shape");
  menuBtn = new Button("", menuIconShape);
  menuBtn.getStyleClass().add("icon");
  menuBtn.setId("menu-button");

  tabBar = new SelectionStrip<>();
  // Reset default sizing from the selectionStrip constructor
  tabBar.setPrefSize(0, 0);
  tabBar.setId("tab-bar");
}
 
Example 5
Source File: AboutStage.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private HBox createBlurbTitle() {
    Label bulrbTitleLabel = createLabel(versionInfo.getBlurbTitle());
    bulrbTitleLabel.setId("blurbTitle");
    bulrbTitleLabel.setAlignment(Pos.TOP_CENTER);

    HBox titleBox = new HBox();
    titleBox.setId("titleBar");
    titleBox.setAlignment(Pos.TOP_CENTER);
    titleBox.getChildren().addAll(bulrbTitleLabel);
    return titleBox;
}
 
Example 6
Source File: ListLayout.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public Node getContent() {
    HBox hBox = new HBox();
    hBox.setId("ListLayout");
    hBox.getStyleClass().add("path-list");
    hBox.getChildren().addAll(createListView(), createVerticalButtonBar());
    hBox.getStyleClass().add(StyleClassHelper.BACKGROUND);
    return hBox;
}
 
Example 7
Source File: SettingsView.java    From Maus with GNU General Public License v3.0 5 votes vote down vote up
private HBox settingsViewLeft() {
    HBox hBox = Styler.hContainer(20);
    hBox.getStylesheets().add(getClass().getResource("/css/global.css").toExternalForm());
    hBox.setId("clientBuilder");
    hBox.setPadding(new Insets(20, 20, 20, 20));
    Label title = (Label) Styler.styleAdd(new Label("Settings"), "title");
    hBox.getChildren().add(Styler.vContainer(20, title));
    return hBox;
}
 
Example 8
Source File: UpdatesView.java    From Maus with GNU General Public License v3.0 5 votes vote down vote up
BorderPane getUpdatesView() {
    updatesView.getStylesheets().add(getClass().getResource("/css/global.css").toExternalForm());
    HBox hBox1 = getUpdatesPanel();
    HBox hBox = getAboutPanel();
    hBox.setId("updatesView");
    hBox1.setId("updatesView");
    hBox.setPadding(new Insets(0, 0, 0, 10));
    updatesView.setTop(new TopBar().getTopBar(Maus.getPrimaryStage()));
    updatesView.setLeft(hBox);
    updatesView.setCenter(hBox1);
    updatesView.setBottom(new BottomBar().getBottomBar());
    return updatesView;
}
 
Example 9
Source File: ClientBuilderView.java    From Maus with GNU General Public License v3.0 5 votes vote down vote up
private HBox clientBuilderSettingsLeft() {
    HBox hBox = Styler.hContainer(20);
    hBox.getStylesheets().add(getClass().getResource("/css/global.css").toExternalForm());
    hBox.setId("clientBuilder");
    hBox.setPadding(new Insets(20, 20, 20, 20));
    Label title = (Label) Styler.styleAdd(new Label("Client Builder"), "title");
    persistent = new CheckBox("Persistent");
    autoSpread = new CheckBox("Auto-Spread");
    hBox.getChildren().add(Styler.vContainer(20, title, persistent, autoSpread));
    return hBox;
}
 
Example 10
Source File: ChooseRepositoryTypePanel.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Populates the content of this component
 */
private void populate() {
    choiceBox = new ComboBox<>(repositoryChoices);
    choiceBox.setPromptText(tr("Please select the repository type you want to add"));

    choiceBox.setConverter(new StringConverter<RepositoryType>() {
        @Override
        public String toString(RepositoryType repositoryType) {
            return repositoryType.getLabel();
        }

        @Override
        public RepositoryType fromString(String string) {
            return Arrays.stream(RepositoryType.values()).filter(type -> type.getLabel().equals(string)).findAny()
                    .orElse(null);
        }
    });

    choiceBox.setOnAction(
            event -> onRepositoryTypeSelection.accept(choiceBox.getSelectionModel().getSelectedItem()));

    Label choiceBoxLabel = new Label(tr("Repository type:"));
    choiceBoxLabel.setLabelFor(choiceBox);

    HBox content = new HBox(choiceBoxLabel, choiceBox);
    content.setId("repositoryTypeSelection");
    HBox.setHgrow(choiceBox, Priority.ALWAYS);

    this.setCenter(content);
}
 
Example 11
Source File: ClasspathRepositoryDetailsPanel.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Populates the repository details step for the classpath repository
 */
private void populate() {
    this.classpathField = new TextField();

    Label classpathLabel = new Label(tr("Classpath:"));
    classpathLabel.setLabelFor(classpathField);

    HBox content = new HBox(classpathLabel, classpathField);
    content.setId("addClasspathRepository");
    HBox.setHgrow(classpathField, Priority.ALWAYS);

    this.setCenter(content);
}
 
Example 12
Source File: NotificationsContainerTest.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
@Test
public void addNotification() {
    NotificationsContainer victim = new NotificationsContainer();
    HBox node = new HBox(new Label("Chuck"));
    node.setId("chuck");
    victim.addNotification("myTitle", node);
    WaitForAsyncUtils.waitForAsyncFx(2000, () -> assertNotNull(victim.lookup("#chuck")));
}
 
Example 13
Source File: SettingsView.java    From Maus with GNU General Public License v3.0 4 votes vote down vote up
private HBox settingsViewCenter() {
    HBox hBox = Styler.hContainer(20);
    hBox.getStylesheets().add(getClass().getResource("/css/global.css").toExternalForm());
    hBox.setId("settingsView");
    hBox.setPadding(new Insets(20, 20, 20, 20));
    Label title = (Label) Styler.styleAdd(new Label(" "), "title");

    Label listeningPortLabel = (Label) Styler.styleAdd(new Label("Listening Port: "), "label-bright");
    TextField listeningPort = new TextField("" + MausSettings.PORT);
    HBox listeningPortBox = Styler.hContainer(listeningPortLabel, listeningPort);
    listeningPort.setEditable(true);
    listeningPort.textProperty().addListener(((observable, oldValue, newValue) -> {
        if (!newValue.matches("\\d*")) {
            listeningPort.setText(newValue.replaceAll("[^\\d]", ""));
        }
    }));

    Label maxConnectionsLabel = (Label) Styler.styleAdd(new Label("Max Connections: "), "label-bright");
    TextField maxConnections = new TextField("" + MausSettings.MAX_CONNECTIONS);
    HBox maxConnectionsBox = Styler.hContainer(maxConnectionsLabel, maxConnections);
    maxConnections.setEditable(true);
    maxConnections.textProperty().addListener(((observable, oldValue, newValue) -> {
        if (!newValue.matches("\\d*")) {
            maxConnections.setText(newValue.replaceAll("[^\\d]", ""));
        }
    }));

    CheckBox soundToggle = new CheckBox();
    soundToggle.setSelected(MausSettings.SOUND);
    if (soundToggle.isSelected()) {
        soundToggle.setText("Sound (on) ");
    } else {
        soundToggle.setText("Sound (off) ");
    }
    soundToggle.setOnAction(event -> {
        if (soundToggle.isSelected()) {
            MausSettings.SOUND = true;
            soundToggle.setText("Sound (on) ");
        } else {
            MausSettings.SOUND = false;
            soundToggle.setText("Sound (off) ");
        }
    });

    CheckBox notificaitonToggle = new CheckBox();
    notificaitonToggle.setSelected(MausSettings.SHOW_NOTIFICATIONS);
    if (notificaitonToggle.isSelected()) {
        notificaitonToggle.setText("Notifications (on) ");
    } else {
        notificaitonToggle.setText("Notifications (off) ");
    }
    notificaitonToggle.setOnAction(event -> {
        if (notificaitonToggle.isSelected()) {
            MausSettings.SHOW_NOTIFICATIONS = true;
            notificaitonToggle.setText("Notifications (on) ");
        } else {
            MausSettings.SHOW_NOTIFICATIONS = false;
            notificaitonToggle.setText("Notifications (off) ");
        }
    });

    CheckBox backgroundPersistentTogle = new CheckBox();
    backgroundPersistentTogle.setSelected(MausSettings.BACKGROUND_PERSISTENT);
    if (backgroundPersistentTogle.isSelected()) {
        backgroundPersistentTogle.setText("Background Persistent (on) ");
    } else {
        backgroundPersistentTogle.setText("Background Persistent (off) ");
    }
    backgroundPersistentTogle.setOnAction(event -> {
        if (backgroundPersistentTogle.isSelected()) {
            MausSettings.BACKGROUND_PERSISTENT = true;
            backgroundPersistentTogle.setText("Background Persistent (on) ");
        } else {
            MausSettings.BACKGROUND_PERSISTENT = false;
            backgroundPersistentTogle.setText("Background Persistent (off) ");
        }
    });

    Button applySettings = new Button("Apply Settings");
    applySettings.setPrefWidth(150);
    applySettings.setPrefHeight(50);
    applySettings.setOnAction(event -> {
        if (Integer.parseInt(listeningPort.getText()) != MausSettings.PORT) {
            MausSettings.PORT = (Integer.parseInt(listeningPort.getText()));
        }
        if (Integer.parseInt(maxConnections.getText()) != MausSettings.MAX_CONNECTIONS) {
            MausSettings.MAX_CONNECTIONS = (Integer.parseInt(maxConnections.getText()));
        }
            Platform.runLater(() -> NotificationView.openNotification("Settings Applied"));
    });
    hBox.getChildren().add(Styler.vContainer(20, title, listeningPortBox, maxConnectionsBox, soundToggle,notificaitonToggle,backgroundPersistentTogle, applySettings));
    return hBox;
}
 
Example 14
Source File: TitleBar.java    From Maus with GNU General Public License v3.0 4 votes vote down vote up
HBox getMenuBar(Stage stage) {
    MenuBar menuBar = new MenuBar();
    menuBar.getStylesheets().add(getClass().getResource("/css/global.css").toExternalForm());
    menuBar.getStyleClass().add("background");

    Label maus = (Label) Styler.styleAdd(new Label("\uD83D\uDC2D " + MausSettings.CURRENT_VERSION), "option-button");
    maus.setPadding(new Insets(5, 10, 5, 10));
    maus.setOnMouseClicked(event -> {
        String[] MausEasterEgg = {
                MausSettings.CURRENT_VERSION,
                "):",
                "Where's the cheese?",
                "#NotaRAT",
                "Please consider donating to Wikipedia",
                "Du haben keine Freunde",
                ":)",
                "Just don't get this shit detected",
                "Stop clicking here",
                "*CRASH*",
                "Whiskers",
                "BlackShades V.5",
                "1 bot = 1 prayer",
                "Why did you click here in the first place?",
                "Maus only continues if I get community feedback!",
                "INF3CTED!!11oneone!1oen",
                "Deditated Wam",
                "Meow",
                "┌(=^‥^=)┘",
                "(^._.^)ノ",
                "\uD83D\uDC31",
                "\uD83D\uDCA5",
                "❤ ❤ ❤",
                "\uD83D\uDC08",
                "\uD83D\uDC01",
                "\uD83D\uDC2D",
                "Cat got your tongue?",
                "Purrrr",
                "Luminosity Maus 1.5",
                "Spreche du Deutsche?",
                "Carrier pigeons are faster",
                "Duct Tape is more stable than this shit",
                "Cat got your tongue?",
                "Stay Tuned!",
                "We're in BETA!",
        };
        Random rn = new Random();
        int rnn = rn.nextInt(MausEasterEgg.length);
        maus.setText(MausEasterEgg[rnn]);
    });

    Label minimize = (Label) Styler.styleAdd(new Label("_"), "option-button");
    minimize.setPadding(new Insets(5, 10, 5, 10));
    minimize.setOnMouseClicked(event -> stage.setIconified(true));

    Label exit = (Label) Styler.styleAdd(new Label("X"), "option-button");
    exit.setPadding(new Insets(5, 10, 5, 10));
    exit.setOnMouseClicked(event -> {
        if (stage.equals(Maus.getPrimaryStage())) {
            Logger.log(Level.INFO, "Exit event detected. ");
            /* Only hide stage if Maus is set to be background persistent */
            if (MausSettings.BACKGROUND_PERSISTENT) {
                Maus.getPrimaryStage().hide();
            } else {
                Platform.exit();
                Maus.systemTray.remove(Maus.systemTray.getTrayIcons()[0]);
                System.exit(0);
            }
        } else {
            stage.close();
        }
    });

    HBox sep = Styler.hContainer();
    sep.setId("drag-bar");
    final Delta dragDelta = new Delta();
    sep.setOnMousePressed(mouseEvent -> {
        dragDelta.x = stage.getX() - mouseEvent.getScreenX();
        dragDelta.y = stage.getY() - mouseEvent.getScreenY();
    });
    sep.setOnMouseDragged(mouseEvent -> {
        stage.setX(mouseEvent.getScreenX() + dragDelta.x);
        stage.setY(mouseEvent.getScreenY() + dragDelta.y);
    });

    HBox hBox = Styler.hContainer(5, maus, sep, minimize, exit);
    hBox.setId("drag-bar");
    return hBox;
}
 
Example 15
Source File: MainScene.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
	 * Creates the earth time bar
	 */
	public void createEarthTimeBar() {

		if (masterClock == null)
			masterClock = sim.getMasterClock();

		if (earthClock == null)
			earthClock = masterClock.getEarthClock();

		datePickerFX = new JFXDatePicker();
		datePickerFX.setValue(earthClock.getLocalDate());
		datePickerFX.setEditable(false);
		// datePickerFX.setDefaultColor(Color.valueOf("#065185"));
		// datePickerFX.setOverLay(true);
		datePickerFX.setShowWeekNumbers(true);
		datePickerFX.setPromptText("Earth Date");
		datePickerFX.setId("earth-time");

		setQuickToolTip(datePickerFX, "Earth Date");

		timePickerFX = new JFXTimePicker();
		timePickerFX.setValue(earthClock.getLocalTime());

		timePickerFX.setEditable(false);
		// timePickerFX.setDefaultColor(Color.valueOf("#065185"));
		// blueDatePicker.setOverLay(true);
		timePickerFX.setPromptText("Earth Time");
		timePickerFX.setId("earth-time");
//		timePickerFX.set24HourView(true);
		
		setQuickToolTip(timePickerFX, "Earth Time in UTC");

		HBox box = new HBox(5, datePickerFX, timePickerFX);

		earthTimeBox = new HBox(box);
		earthTimeBox.setId("earth-time-box");
		earthTimeBox.setAlignment(Pos.CENTER);

		if (OS.contains("linux")) {
			earthTimeBox.setPrefSize(50, 25); // 270
			datePickerFX.setPrefSize(25, 25);// 160, 29);
			timePickerFX.setPrefSize(25, 25);// 140, 29);
		} else if (OS.contains("mac")) {
			earthTimeBox.setPrefSize(50, 23); // 230
			datePickerFX.setPrefSize(23, 23);
			timePickerFX.setPrefSize(23, 23);
		} else {
			earthTimeBox.setPrefSize(50, 25);
			datePickerFX.setPrefSize(25, 25);// 130, 25);
			timePickerFX.setPrefSize(25, 25);// 110, 25);
		}

	}
 
Example 16
Source File: WorkAreaTest.java    From pdfsam with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public Pane modulePanel() {
    HBox panel = new HBox();
    panel.setId("modulePane");
    return panel;
}