List of usage examples for javafx.scene.layout HBox HBox
public HBox()
From source file:mesclasses.view.TimetableController.java
private VBox createEvent(Cours theCours) { VBox event = new VBox(); CssUtil.addClass(event, "event"); CssUtil.addClass(event, getCSS(theCours)); String periodicite = theCours.getWeek().equals(config.getProperty(Constants.CONF_WEEK_DEFAULT)) ? "" : theCours.getWeek();/* w ww. j a v a 2 s .c o m*/ String salle = StringUtils.isNotBlank(theCours.getRoom()) ? "salle " + theCours.getRoom() : ""; Label periodiciteAndSalle = new Label((periodicite + " " + salle).trim()); bindWidth(periodiciteAndSalle, event, 1); Label classe = new Label(theCours.getClasse().getName()); CssUtil.addClass(classe, "event-classe"); bindWidth(classe, event, 1); //horaires HBox horaires = new HBox(); CssUtil.addClass(horaires, "horaires"); Label start = new Label(" " + NodeUtil.getStartTime(theCours)); CssUtil.addClass(start, "start"); Label end = new Label(NodeUtil.getEndTime(theCours) + " "); CssUtil.addClass(end, "end"); horaires.getChildren().add(start); horaires.getChildren().add(end); bindWidth(horaires, event, 1); bindWidth(start, horaires, 2); bindWidth(end, horaires, 2); event.getChildren().add(periodiciteAndSalle); bindHeight(periodiciteAndSalle, event, 3); event.getChildren().add(classe); bindHeight(classe, event, 3); event.getChildren().add(horaires); bindHeight(horaires, event, 3); event.setOnMouseReleased((e) -> { handleEditCours(theCours); }); theCours.setEvent(event); return event; }
From source file:ch.tuason.djbattlescore.lib.components.comps.ResultGridPane.java
/** * adds a certain DjEntity to the ranking grid panel... * /*from w ww. ja v a 2s .co m*/ * @param results a Collection of DjEntity... */ public void addCurrentDJRanking(Collection<DjEntity> results) { this.addedRankingComponents.clear(); this.currentDjRanking = results; if (this.currentDjRanking != null && !this.currentDjRanking.isEmpty()) { int iPos = 1; for (DjEntity dj : this.currentDjRanking) { Image djImage = null; if (!StringUtils.isEmpty(dj.getAvatarPicPath32())) { djImage = getImageFromCache(dj); if (djImage == null) { try { djImage = new Image(getClass().getResourceAsStream( DjBattleConstants.IMAGE_RESOURCE_BASE_FOR_DJ_PICS + dj.getAvatarPicPath32())); if (!djImage.isError()) { imageCache.put(dj.getId(), djImage); } } catch (Exception e) { System.out.println("the image for dj '" + dj.getName() + "' could not be loaded for the avatar image... " + e.getMessage()); djImage = null; } } // it might be an absolute path? if (djImage == null) { try { djImage = new Image( DjBattleConstants.ABSOLUTE_IMAGE_FILEPATH_PREFIX + dj.getAvatarPicPath32()); if (!djImage.isError()) { imageCache.put(dj.getId(), djImage); } } catch (Exception e) { System.out.println("the image for dj '" + dj.getName() + "' could not be loaded for the avatar image... " + e.getMessage()); djImage = null; } } if (djImage == null) { djImage = getStandardImage(); } } if (StringUtils.isEmpty(dj.getAvatarPicPath32()) || djImage == null) { djImage = getStandardImage(); } HBox djComponent = new HBox(); djComponent.setPadding(new Insets(5, 0, 0, 20)); Label djLabel = new Label(dj.getDjNameWithSoundStyle(), new ImageView(djImage)); djLabel.setFont(new Font("Arial", 20)); // component.setTextFill(Color.web(DjBattleConstants.COLOR_RESULT_TITLE_TEXT)); djComponent.getChildren().add(djLabel); this.addedRankingComponents.add(djComponent); this.add(djComponent, 0, iPos); iPos++; } } }
From source file:io.bitsquare.gui.components.paymentmethods.SepaForm.java
@Override public void addFormForAddAccount() { gridRowFrom = gridRow + 1;// w ww .j ava2s . c om InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:").second; holderNameInputTextField.setValidator(inputValidator); holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { sepaAccount.setHolderName(newValue); updateFromInputs(); }); ibanInputTextField = addLabelInputTextField(gridPane, ++gridRow, "IBAN:").second; ibanInputTextField.setValidator(ibanValidator); ibanInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { sepaAccount.setIban(newValue); updateFromInputs(); }); bicInputTextField = addLabelInputTextField(gridPane, ++gridRow, "BIC:").second; bicInputTextField.setValidator(bicValidator); bicInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { sepaAccount.setBic(newValue); updateFromInputs(); }); addLabel(gridPane, ++gridRow, "Country of bank:"); HBox hBox = new HBox(); hBox.setSpacing(10); ComboBox<Country> countryComboBox = new ComboBox<>(); currencyComboBox = new ComboBox<>(); currencyTextField = new TextField(""); currencyTextField.setEditable(false); currencyTextField.setMouseTransparent(true); currencyTextField.setFocusTraversable(false); currencyTextField.setMinWidth(300); currencyTextField.setVisible(false); currencyTextField.setManaged(false); currencyComboBox.setVisible(false); currencyComboBox.setManaged(false); hBox.getChildren().addAll(countryComboBox, currencyTextField, currencyComboBox); GridPane.setRowIndex(hBox, gridRow); GridPane.setColumnIndex(hBox, 1); gridPane.getChildren().add(hBox); countryComboBox.setPromptText("Select country of bank"); countryComboBox.setConverter(new StringConverter<Country>() { @Override public String toString(Country country) { return country.name + " (" + country.code + ")"; } @Override public Country fromString(String s) { return null; } }); countryComboBox.setOnAction(e -> { Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem(); sepaAccount.setCountry(selectedItem); TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(selectedItem.code); setupCurrency(selectedItem, currency); updateCountriesSelection(true, euroCountryCheckBoxes); updateCountriesSelection(true, nonEuroCountryCheckBoxes); updateFromInputs(); }); addEuroCountriesGrid(true); addNonEuroCountriesGrid(true); addAllowedPeriod(); addAccountNameTextFieldWithAutoFillCheckBox(); countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllSepaCountries())); Country country = CountryUtil.getDefaultCountry(); if (CountryUtil.getAllSepaCountries().contains(country)) { countryComboBox.getSelectionModel().select(country); sepaAccount.setCountry(country); TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(country.code); setupCurrency(country, currency); } updateFromInputs(); }
From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java
private void openAccountManager() { //Window Crap Stage accountManagerStage = new Stage(); accountManagerStage.setTitle("Starbound Server Account Manager"); GridPane gp = new GridPane(); gp.setAlignment(Pos.CENTER);//w w w .ja va2s . c o m gp.setVgap(10); gp.setHgap(10); gp.setPadding(new Insets(25, 25, 25, 25)); Text title = new Text("Starbound Account Manager"); title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20)); gp.add(title, 0, 0, 2, 1); ListView<String> user_list = new ListView<String>(); ObservableList<String> user_list_o = FXCollections.observableArrayList(users); user_list.setItems(user_list_o); user_list.setPrefHeight(50); ListView<String> banned_users_list = new ListView<String>(); ObservableList<String> banned_users_list_o = FXCollections.observableArrayList(banned_usernames); banned_users_list.setItems(banned_users_list_o); banned_users_list.setPrefHeight(50); ListView<String> banned_ips_list = new ListView<String>(); ObservableList<String> banned_ips_list_o = FXCollections.observableArrayList(banned_ips); banned_ips_list.setItems(banned_ips_list_o); banned_ips_list.setPrefHeight(50); ListView<String> banned_playernames_list = new ListView<String>(); ObservableList<String> banned_playernames_list_o = FXCollections.observableArrayList(banned_playernames); banned_playernames_list.setItems(banned_playernames_list_o); banned_playernames_list.setPrefHeight(50); Label user_list_l = new Label("Current Users"); Label banned_users_list_l = new Label("Banned Users"); Label banned_ips_list_l = new Label("Banned IP's"); Label banned_playernames_list_l = new Label("Banned Player Names"); Button add_user = new Button("Add User"); Button add_banned_user = new Button("Add Banned User"); Button add_banned_ip = new Button("Add Banned IP"); Button add_banned_playername = new Button("Add Banner Playername"); Button remove_user = new Button("Remove User"); Button remove_banned_user = new Button("Remove Banned User"); Button remove_banned_ip = new Button("Remove Banned IP"); Button remove_banned_playername = new Button("Remove Banner Playername"); HBox userbox = new HBox(); userbox.setAlignment(Pos.BOTTOM_LEFT); userbox.getChildren().addAll(add_user, remove_user); userbox.setSpacing(5); HBox b_userbox = new HBox(); b_userbox.setAlignment(Pos.BOTTOM_LEFT); b_userbox.getChildren().addAll(add_banned_user, remove_banned_user); b_userbox.setSpacing(5); HBox b_ipbox = new HBox(); b_ipbox.setAlignment(Pos.BOTTOM_LEFT); b_ipbox.getChildren().addAll(add_banned_ip, remove_banned_ip); b_ipbox.setSpacing(5); HBox b_playerbox = new HBox(); b_playerbox.setAlignment(Pos.BOTTOM_LEFT); b_playerbox.getChildren().addAll(add_banned_playername, remove_banned_playername); b_playerbox.setSpacing(5); Button save = new Button("Save Config"); save.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { save(); } }); add_user.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { createAccount(user_list); } }); add_banned_user.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { createBannedUser(banned_users_list); } }); add_banned_ip.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { createBannedIP(banned_ips_list); } }); add_banned_playername.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { createBannedPlayername(banned_playernames_list); } }); remove_user.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { users.remove(user_list.getSelectionModel().getSelectedItem()); user_list.setItems(FXCollections.observableArrayList(users)); } }); remove_banned_user.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { banned_usernames.remove(banned_users_list.getSelectionModel().getSelectedItem()); banned_users_list.setItems(FXCollections.observableArrayList(banned_usernames)); } }); remove_banned_ip.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { banned_ips.remove(banned_ips_list.getSelectionModel().getSelectedItem()); banned_ips_list.setItems(FXCollections.observableArrayList(banned_ips)); } }); remove_banned_playername.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { banned_playernames.remove(banned_playernames_list.getSelectionModel().getSelectedItem()); banned_playernames_list.setItems(FXCollections.observableArrayList(banned_playernames)); } }); gp.add(user_list_l, 0, 1); gp.add(user_list, 0, 2); gp.add(userbox, 0, 3); gp.add(banned_users_list_l, 0, 4); gp.add(banned_users_list, 0, 5); gp.add(b_userbox, 0, 6); gp.add(banned_ips_list_l, 0, 7); gp.add(banned_ips_list, 0, 8); gp.add(b_ipbox, 0, 9); gp.add(banned_playernames_list_l, 0, 10); gp.add(banned_playernames_list, 0, 11); gp.add(b_playerbox, 0, 12); gp.add(save, 0, 13); Scene sc = new Scene(gp, 800 / 2, 600); accountManagerStage.setScene(sc); accountManagerStage.show(); }
From source file:dsfixgui.view.DSFHudPane.java
private void initialize() { //Basic layout this.setFitToWidth(true); spacerColumn = new ColumnConstraints(); spacerColumn.setFillWidth(true);//from w w w . j a va2s . c o m spacerColumn.setPercentWidth(3.0); primaryColumn = new ColumnConstraints(); primaryColumn.setFillWidth(true); primaryColumn.setPercentWidth(95.0); primaryPane = new GridPane(); primaryPane.getColumnConstraints().addAll(spacerColumn, primaryColumn); primaryVBox = new VBox(); primaryVBox.getStyleClass().add("spacing_15"); primaryPane.add(primaryVBox, 1, 0); titleLabel = new Label(HUD.toUpperCase() + " " + SETTINGS.toUpperCase()); titleLabel.getStyleClass().add("settings_title"); titleBar = new HBox(); titleBar.setAlignment(Pos.CENTER); titleBar.getChildren().add(titleLabel); restoreDefaultsBar = new HBox(); restoreDefaultsBar.setAlignment(Pos.CENTER); restoreDefaultsBar.setSpacing(5.0); applySettingsButton = new Button(APPLY_SETTINGS); restoreDefaultsButton = new Button(RESTORE_DEFAULTS); applySettingsButton.getStyleClass().add("translate_y_4"); restoreDefaultsButton.getStyleClass().add("translate_y_4"); restoreDefaultsBar.getChildren().addAll(applySettingsButton, restoreDefaultsButton); spacerHBox = new HBox(); spacerHBox.setMinHeight(10.0); bottomSpacerHBox = new HBox(); bottomSpacerHBox.setMinHeight(10.0); /////////////////////SETTINGS PANES///////////////////// // // //Toggle HUD Modifications hudModsPane = new FlowPane(); hudModsPane.getStyleClass().add("settings_pane"); hudModsLabel = new Label(HUD_MODS_LABEL + " "); hudModsLabel.getStyleClass().addAll("bold_text", "font_12_pt"); hudModsLabel.setTooltip(new Tooltip(HUD_MODS_TT)); hudModsPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE)); if (config.enableHudMod.get() == 0) { hudModsPicker.setValue(hudModsPicker.getItems().get(0)); } else { hudModsPicker.setValue(hudModsPicker.getItems().get(1)); } hudModsPane.getChildren().addAll(hudModsLabel, hudModsPicker); // //Minimal HUD minimalHUDPane = new FlowPane(); minimalHUDPane.getStyleClass().add("settings_pane"); minimalHUDLabel = new Label(MINIMAL_HUD_LABEL + " "); minimalHUDLabel.getStyleClass().addAll("bold_text", "font_12_pt"); minimalHUDLabel.setTooltip(new Tooltip(MIN_HUD_TT)); minimalHUDPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE)); if (config.enableMinimalHud.get() == 0) { minimalHUDPicker.setValue(minimalHUDPicker.getItems().get(0)); } else { minimalHUDPicker.setValue(minimalHUDPicker.getItems().get(1)); } minimalHUDPane.getChildren().addAll(minimalHUDLabel, minimalHUDPicker); // //HUD Scale hudScalePane = new FlowPane(); hudScalePane.getStyleClass().add("settings_pane"); hudScaleLabel = new Label(HUD_SCALE_LABEL + " "); hudScaleLabel.getStyleClass().addAll("bold_text", "font_12_pt"); hudScaleLabel.setTooltip(new Tooltip(HUD_SCALE_TT)); hudScaleField = new TextField(config.hudScaleFactor.toString()); hudScaleField.getStyleClass().add("settings_med_text_field"); hudScalePane.getChildren().addAll(hudScaleLabel, hudScaleField); // //HUD Opacities Parent Label hudOpacitiesPane = new FlowPane(); hudOpacitiesPane.getStyleClass().add("settings_pane"); hudOpacitiesLabel = new Label(HUD_OPACITIES_LABEL + " "); hudOpacitiesLabel.getStyleClass().addAll("bold_text", "font_14_pt"); hudOpacitiesLabel.setTooltip(new Tooltip(HUD_OPS_TT)); hudOpacitiesPane.getChildren().addAll(hudOpacitiesLabel); // //Top Left HUD Opacity topLeftHUDOpPane = new FlowPane(); topLeftHUDOpPane.getStyleClass().add("settings_pane"); topLeftHUDOpLabel = new Label(TOP_LEFT_HUD_OP_LABEL + " "); topLeftHUDOpLabel.getStyleClass().addAll("bold_text", "font_12_pt"); topLeftHUDOpLabel.setTooltip(new Tooltip(TOP_LEFT_HUD_TT)); topLeftHUDOpField = new TextField( config.hudTopLeftOpacity.toString().substring(0, config.hudTopLeftOpacity.length() - 1)); topLeftHUDOpField.getStyleClass().add("settings_med_text_field"); topLeftHUDOpPane.getChildren().addAll(topLeftHUDOpLabel, topLeftHUDOpField); // //Bottom Left HUD Opacity bottomLeftHUDOpPane = new FlowPane(); bottomLeftHUDOpPane.getStyleClass().add("settings_pane"); bottomLeftHUDOpLabel = new Label(BOTTOM_LEFT_HUD_OP_LABEL + " "); bottomLeftHUDOpLabel.getStyleClass().addAll("bold_text", "font_12_pt"); bottomLeftHUDOpLabel.setTooltip(new Tooltip(BOTTOM_LEFT_HUD_TT)); bottomLeftHUDOpField = new TextField( config.hudBottomLeftOpacity.toString().substring(0, config.hudBottomLeftOpacity.length() - 1)); bottomLeftHUDOpField.getStyleClass().add("settings_med_text_field"); bottomLeftHUDOpPane.getChildren().addAll(bottomLeftHUDOpLabel, bottomLeftHUDOpField); // //Bottom Riht HUD Opacity bottomRightHUDOpPane = new FlowPane(); bottomRightHUDOpPane.getStyleClass().add("settings_pane"); bottomRightHUDOpLabel = new Label(BOTTOM_RIGHT_HUD_OP_LABEL + " "); bottomRightHUDOpLabel.getStyleClass().addAll("bold_text", "font_12_pt"); bottomRightHUDOpLabel.setTooltip(new Tooltip(BOTTOM_RIGHT_HUD_TT)); bottomRightHUDOpField = new TextField( config.hudBottomRightOpacity.toString().substring(0, config.hudBottomRightOpacity.length() - 1)); bottomRightHUDOpField.getStyleClass().add("settings_med_text_field"); bottomRightHUDOpPane.getChildren().addAll(bottomRightHUDOpLabel, bottomRightHUDOpField); if (config.enableHudMod.get() == 0) { minimalHUDPicker.setDisable(true); hudScaleField.setDisable(true); topLeftHUDOpField.setDisable(true); bottomLeftHUDOpField.setDisable(true); bottomRightHUDOpField.setDisable(true); } primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, hudModsPane, minimalHUDPane, hudScalePane, hudOpacitiesPane, topLeftHUDOpPane, bottomLeftHUDOpPane, bottomRightHUDOpPane, bottomSpacerHBox); initializeEventHandlers(); this.setContent(primaryPane); }
From source file:fr.amap.commons.javafx.chart.ChartViewer.java
public void insertChart(JFreeChart chart) { final ChartCanvas chartCanvas = new ChartCanvas(chart); if ((chartCanvasList.size() / (vBoxPane.getChildren().size())) >= maxChartNumberInARow) { currentRowIndex++;/*from w w w . ja va 2s. com*/ vBoxPane.getChildren().add(new HBox()); } ((HBox) vBoxPane.getChildren().get(currentRowIndex)).getChildren().add(chartCanvas); ((HBox) vBoxPane.getChildren().get(currentRowIndex)).setAlignment(Pos.CENTER_LEFT); chartCanvasList.add(chartCanvas); refreshChartPositionAndSize(); }
From source file:ch.tuason.djbattlescore.lib.components.comps.NowPlayingImageRotator.java
private HBox getImageViewPanel(ImageView view) { if (imageViewPanel == null) { imageViewPanel = new HBox(); imageViewPanel.setPadding(new Insets(5, 0, 0, 30)); imageViewPanel.getChildren().add(view); }/*from ww w. j a va 2 s . c o m*/ return imageViewPanel; }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private static void addRow4(final Pane content, final BookingBean be) { final HBox box = new HBox(); box.setPadding(new Insets(4)); box.setAlignment(Pos.CENTER_LEFT);/*from ww w . j a v a 2 s. com*/ box.setFillHeight(true); final TextFlow tf = new TextFlow(); final Text t0 = new Text("Net Earnings: \t"); final Text netEarnings = new Text(String.format("%3.2f", be.getNetEarnings())); final Text t1 = new Text(" total \t"); final Text netEarningsDay = new Text(String.format("%3.2f", be.getNetEarnings() / be.getNumberOfNights())); final Text t2 = new Text(" /night"); tf.getChildren().addAll(t0, netEarnings, t1, netEarningsDay, t2); box.getChildren().addAll(tf); if (be.getNetEarnings() <= 0) { box.getStyleClass().addAll("warning", "warning-bg"); } content.getChildren().add(box); }
From source file:com.panemu.tiwulfx.form.BaseControl.java
private PopupControl getPopup() { if (popup == null) { errorLabel = new Label(); errorLabel.textProperty().bind(getErrorMessage()); popup = new PopupControl(); final HBox pnl = new HBox(); pnl.getChildren().add(errorLabel); pnl.getStyleClass().add("error-popup"); popup.setSkin(new Skin() { @Override// w ww .j a v a 2s .co m public Skinnable getSkinnable() { return BaseControl.this.getInputComponent(); } @Override public Node getNode() { return pnl; } @Override public void dispose() { } }); popup.setHideOnEscape(true); } return popup; }
From source file:RemoveDuplicateFiles.java
public static Scene makeScene() { //Setup the main BorderPane (Holds all the things) BorderPane backPane = new BorderPane(); //---------------------------------------------------------------------- //Setup the Main Menu Buttons & Pane sortFilesButton = new Button("Sort Files"); batchRenameButton = new Button("Batch Rename Files"); HBox mainButtons = new HBox(); mainButtons.setPadding(new Insets(15, 12, 15, 12)); mainButtons.setSpacing(10);/*ww w. j a va2s . c o m*/ mainButtons.setStyle(BUTTON_STYLE); mainButtons.getChildren().add(sortFilesButton); mainButtons.getChildren().add(batchRenameButton); backPane.setTop(mainButtons); //---------------------------------------------------------------------- //Setup the filetypes box HBox fileTypePane = GUIFactories.getFileTypeBox(fileTypes); backPane.setBottom(fileTypePane); //---------------------------------------------------------------------- //Setup the FileType Pre-set Buttons VBox preSets = GUIFactories.getPresets(fileTypes); backPane.setRight(preSets); //---------------------------------------------------------------------- //Setup the center GridPane rmvButton = new Button("Remove Duplicates"); actionTarget = new Text(); GridPane grid = GUIFactories.getCenterPane(address, rmvButton, actionTarget); backPane.setCenter(grid); //---------------------------------------------------------------------- Scene scene = new Scene(backPane, WIDTH, HEIGHT); return scene; }