List of usage examples for javafx.geometry HPos LEFT
HPos LEFT
To view the source code for javafx.geometry HPos LEFT.
Click Source Link
From source file:Main.java
private GridPane createGridPane() { GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(5);/*w ww . j av a 2 s .c o m*/ gridpane.setVgap(5); ColumnConstraints column1 = new ColumnConstraints(100); ColumnConstraints column2 = new ColumnConstraints(50, 150, 300); column2.setHgrow(Priority.ALWAYS); gridpane.getColumnConstraints().addAll(column1, column2); Label fNameLbl = new Label("First Name"); TextField fNameFld = new TextField(); Label lNameLbl = new Label("Last Name"); TextField lNameFld = new TextField(); Button saveButton = new Button("Save"); GridPane.setHalignment(fNameLbl, HPos.RIGHT); GridPane.setHalignment(lNameLbl, HPos.RIGHT); GridPane.setHalignment(fNameFld, HPos.LEFT); GridPane.setHalignment(lNameFld, HPos.LEFT); GridPane.setHalignment(saveButton, HPos.RIGHT); gridpane.add(fNameLbl, 0, 0); gridpane.add(fNameFld, 1, 0); gridpane.add(lNameLbl, 0, 1); gridpane.add(lNameFld, 1, 1); gridpane.add(saveButton, 1, 2); return gridpane; }
From source file:de.perdoctus.ebikeconnect.gui.dialogs.LoginDialog.java
@PostConstruct public void init() { final ImageView graphic = new ImageView( new Image(getClass().getResource("/app-icon.png").toExternalForm())); graphic.setPreserveRatio(true);// w ww. jav a 2s.c o m graphic.setFitHeight(64); setGraphic(graphic); setResizable(true); setWidth(400); setResizable(false); setTitle(rb.getString("dialogTitle")); setHeaderText(rb.getString("dialogMessage")); final ButtonType loginButtonType = new ButtonType(rb.getString("loginButton"), ButtonBar.ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL); // Create the username and password labels and fields. final GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(20, 10, 10, 10)); grid.setPrefWidth(getWidth()); grid.getColumnConstraints().add(new ColumnConstraints(-1, -1, -1, Priority.NEVER, HPos.LEFT, true)); grid.getColumnConstraints().add(new ColumnConstraints(-1, -1, -1, Priority.ALWAYS, HPos.LEFT, true)); final String rbUsername = rb.getString(CFG_USERNAME); final TextField txtUsername = new TextField(); txtUsername.setPromptText(rbUsername); txtUsername.setText(config.getString(CFG_USERNAME, "")); final Label lblUsername = new Label(rbUsername); lblUsername.setLabelFor(txtUsername); grid.add(lblUsername, 0, 0); grid.add(txtUsername, 1, 0); final String rbPassword = rb.getString(CFG_PASSWORD); final PasswordField txtPassword = new PasswordField(); txtPassword.setPromptText(rbPassword); if (config.getBoolean(CFG_SAVE_PASSWORD, false)) { txtPassword.setText(config.getString(CFG_PASSWORD, "")); } final Label lblPassword = new Label(rbPassword); lblPassword.setLabelFor(txtPassword); grid.add(lblPassword, 0, 1); grid.add(txtPassword, 1, 1); final CheckBox cbSavePassword = new CheckBox(rb.getString("save-password")); cbSavePassword.setSelected(config.getBoolean(CFG_SAVE_PASSWORD, false)); grid.add(cbSavePassword, 1, 2); getDialogPane().setContent(grid); // Enable/Disable login button depending on whether a username was entered. final Node loginButton = getDialogPane().lookupButton(loginButtonType); loginButton.disableProperty() .bind(txtUsername.textProperty().isEmpty().or(txtPassword.textProperty().isEmpty())); setResultConverter(buttonType -> { if (buttonType == loginButtonType) { config.setProperty(CFG_USERNAME, txtUsername.getText()); config.setProperty(CFG_SAVE_PASSWORD, cbSavePassword.isSelected()); if (cbSavePassword.isSelected()) { config.setProperty(CFG_PASSWORD, txtPassword.getText()); config.setProperty(CFG_PASSWORD, txtPassword.getText()); } else { config.clearProperty(CFG_PASSWORD); } return new Credentials(txtUsername.getText(), txtPassword.getText()); } else { return null; } }); if (txtUsername.getText().isEmpty()) { txtUsername.requestFocus(); } else { txtPassword.requestFocus(); txtPassword.selectAll(); } }
From source file:mesclasses.view.RapportClasseController.java
private void drawRow(Eleve eleve, int rowIndex) { LOG.debug("rapports : drawing row for " + eleve); List<EleveData> data = model.filterDataByTrimestre(eleve.getData(), smartSelect.getValue(), null); grid.add(NodeUtil.buildEleveLink(eleve, eleve.lastNameProperty(), Constants.CLASSE_RAPPORT_TABS_VIEW), 1, rowIndex, HPos.LEFT); grid.add(NodeUtil.buildEleveLink(eleve, eleve.firstNameProperty(), Constants.CLASSE_RAPPORT_TABS_VIEW), 2, rowIndex, HPos.LEFT);/*from w w w .j a v a2 s . com*/ // ABSENT long abs = data.stream().filter(d -> d.isAbsent()).count(); Label absent = new Label(String.valueOf(abs)); grid.add(absent, 3, rowIndex, null); // RETARD long ret = data.stream().filter(d -> d.getRetard() > 0).count(); Label retard = new Label(String.valueOf(ret)); grid.add(retard, 4, rowIndex, null); // TRAVAIL long tr = data.stream().filter(d -> d.isTravailPasFait()).count(); Label travail = new Label(String.valueOf(tr)); grid.add(travail, 5, rowIndex, null); // DEVOIR Label devoir = new Label( "" + model.filterDevoirsByTrimestre(eleve.getDevoirs(), smartSelect.getValue(), null).size()); grid.add(devoir, 6, rowIndex, null); // PUNITION Label punition = new Label( "" + model.filterPunitionsByTrimestre(eleve.getPunitions(), smartSelect.getValue(), null).size()); grid.add(punition, 7, rowIndex, null); // MOT CARNET Label mot = new Label( "" + model.filterMotsByTrimestre(eleve.getMots(), smartSelect.getValue(), null).size()); grid.add(mot, 8, rowIndex, null); // OUBLI MATERIEL long om = data.stream().filter(d -> StringUtils.isNotBlank(d.getOubliMateriel())).count(); Label oubli = new Label(String.valueOf(om)); grid.add(oubli, 9, rowIndex, null); // EXCLUSION long ex = data.stream().filter(d -> d.isExclus()).count(); Label exclus = new Label(String.valueOf(ex)); grid.add(exclus, 10, rowIndex, null); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXScopeAttrPane.java
public CFBamJavaFXScopeAttrPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamScopeObj argFocus) {/*w ww.j a va2 s . co m*/ super(); Control ctrl; CFLabel label; CFReferenceEditor reference; final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; setJavaFXFocusAsScope(argFocus); setPadding(new Insets(5)); setHgap(5); setVgap(5); setAlignment(Pos.CENTER); ColumnConstraints column1 = new ColumnConstraints(125); ColumnConstraints column2 = new ColumnConstraints(125, 300, 500); column2.setHgrow(Priority.ALWAYS); getColumnConstraints().addAll(column1, column2); int gridRow = 0; label = getJavaFXLabelId(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); ctrl = getJavaFXEditorId(); setHalignment(ctrl, HPos.LEFT); add(ctrl, 1, gridRow); gridRow++; populateFields(); adjustComponentEnableStates(); javafxIsInitializing = false; }
From source file:eu.ggnet.dwoss.receipt.shipment.ShipmentUpdateStage.java
private void init(Shipment s) { okButton.setOnAction((ActionEvent event) -> { shipment = getShipment();/*from w ww . j a v a2s . c o m*/ if (isValid()) close(); }); cancelButton.setOnAction((ActionEvent event) -> { close(); }); idField = new TextField(Long.toString(s.getId())); idField.setDisable(true); shipIdField = new TextField(s.getShipmentId()); Callback<ListView<TradeName>, ListCell<TradeName>> cb = new Callback<ListView<TradeName>, ListCell<TradeName>>() { @Override public ListCell<TradeName> call(ListView<TradeName> param) { return new ListCell<TradeName>() { @Override protected void updateItem(TradeName item, boolean empty) { super.updateItem(item, empty); if (item == null || empty) setText("Hersteller whlen..."); else setText(item.getName()); } }; } }; Set<TradeName> contractors = Client.lookup(MandatorSupporter.class).loadContractors().all(); ownerBox = new ComboBox<>(FXCollections.observableArrayList(contractors)); ownerBox.setMaxWidth(MAX_VALUE); ownerBox.setCellFactory(cb); ownerBox.getSelectionModel().selectedItemProperty().addListener( (ObservableValue<? extends TradeName> observable, TradeName oldValue, TradeName newValue) -> { if (newValue == null) return; shipment.setContractor(newValue); manufacturerBox.getSelectionModel().select(newValue.getManufacturer()); }); ObservableList<TradeName> manufacturers = FXCollections.observableArrayList(TradeName.getManufacturers()); manufacturerBox = new ComboBox<>(manufacturers); manufacturerBox.setMaxWidth(MAX_VALUE); manufacturerBox.setCellFactory(cb); SingleSelectionModel<TradeName> sm = ownerBox.getSelectionModel(); if (s.getContractor() == null) sm.selectFirst(); else sm.select(s.getContractor()); if (shipment.getDefaultManufacturer() != null) manufacturerBox.getSelectionModel().select(shipment.getDefaultManufacturer()); statusBox = new ComboBox<>(FXCollections.observableArrayList(Shipment.Status.values())); statusBox.setMaxWidth(MAX_VALUE); statusBox.getSelectionModel().select(s.getStatus() == null ? OPENED : s.getStatus()); GridPane grid = new GridPane(); grid.addRow(1, new Label("ID:"), idField); grid.addRow(2, new Label("Shipment ID:"), shipIdField); grid.addRow(3, new Label("Besitzer:"), ownerBox); grid.addRow(4, new Label("Hersteller:"), manufacturerBox); grid.addRow(5, new Label("Status"), statusBox); grid.setMaxWidth(MAX_VALUE); grid.vgapProperty().set(2.); grid.getColumnConstraints().add(0, new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.SOMETIMES, HPos.LEFT, false)); grid.getColumnConstraints().add(1, new ColumnConstraints(100, 150, Double.MAX_VALUE, Priority.ALWAYS, HPos.LEFT, true)); HBox hButtonBox = new HBox(okButton, cancelButton); hButtonBox.alignmentProperty().set(Pos.TOP_RIGHT); errorLabel.setWrapText(true); BorderPane rootPane = new BorderPane(grid, errorLabel, null, hButtonBox, null); this.setTitle(s.getId() > 0 ? "Shipment bearbeiten" : "Shipment anlegen"); this.setScene(new Scene(rootPane)); this.setResizable(false); }
From source file:gov.va.isaac.gui.listview.operations.UscrsExportOperation.java
@Override public void init(ObservableList<SimpleDisplayConcept> conceptList) { root.setHgap(10);/*from w w w . j av a2 s . c o m*/ root.setVgap(10); super.init(conceptList); String date = new SimpleDateFormat("MM-dd-yyyy HH-mm-ss").format(new Date()); fileName = "VA_USCRS_Submission_File_" + date; //this.chooseFileName(); TODO: Finish the file name system fileChooser.setTitle("Save USCRS Concept Request File"); fileChooser.getExtensionFilters().addAll(new ExtensionFilter("Excel Files .xls .xlsx", "*.xls", "*.xlsx")); fileChooser.setInitialFileName(fileName); // outputProperty.set(outputField.textProperty()); openFileChooser.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent e) { file = fileChooser.showSaveDialog(null); if (file != null) { if (file.getAbsolutePath() != null && file.getAbsolutePath() != "") { outputField.setText(file.getAbsolutePath()); filePath = file.getAbsolutePath(); logger_.info("File Path Changed: " + filePath); } } } }); outputField.setOnAction( //TODO: So you can manually type in a file path and it validates (break this out) new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent e) { filePath = outputField.getText(); file = new File(filePath); } }); allFieldsValid = new ValidBooleanBinding() { { bind(outputField.textProperty()); setComputeOnInvalidate(true); } /* (non-Javadoc) * @see javafx.beans.binding.BooleanBinding#computeValue() */ @Override protected boolean computeValue() { if (outputField.getText() != "" || !outputField.getText().trim().isEmpty()) { String fieldOutput = outputField.getText(); if (filePath != null && !fieldOutput.isEmpty() && file != null) //fieldOutput is repetetive but necessary { int lastSeperatorPosition = outputField.getText().lastIndexOf(File.separator); String path = ""; if (lastSeperatorPosition > 0) { path = outputField.getText().substring(0, lastSeperatorPosition); } else { path = outputField.getText(); } logger_.debug("Output Directory: " + path); File f = new File(path); if (file.isFile()) { //If we want to prevent file overwrite this.setInvalidReason("The file " + filePath + " already exists"); return false; } else if (f.isDirectory()) { return true; } else { this.setInvalidReason("Output Path is not a directory"); return false; } } else { this.setInvalidReason("File Output Directory is not set - output field null!!"); return false; } } else { this.setInvalidReason("Output field is empty, output directory is not set"); return false; } } }; root.add(openFileChooser, 2, 0); GridPane.setHalignment(openFileChooser, HPos.LEFT); Label outputLocationLabel = new Label("Output Location"); root.add(outputLocationLabel, 0, 0); GridPane.setHalignment(outputLocationLabel, HPos.LEFT); StackPane sp = ErrorMarkerUtils.setupErrorMarker(outputField, null, allFieldsValid); root.add(sp, 1, 0); GridPane.setHgrow(sp, Priority.ALWAYS); GridPane.setHalignment(sp, HPos.LEFT); Label datePickerLabel = new Label("Export Date Filter"); root.add(datePickerLabel, 0, 1); GridPane.setHalignment(datePickerLabel, HPos.LEFT); root.add(datePicker, 1, 1); Label allDatesLabel = new Label("Export All Concepts"); root.add(allDatesLabel, 0, 2); skipFilterCheckbox.setText("Export All Concepts (No Filters)"); skipFilterCheckbox.setSelected(false); root.add(skipFilterCheckbox, 1, 2); super.root_ = root; }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXEnumTagAttrPane.java
public CFBamJavaFXEnumTagAttrPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamEnumTagObj argFocus) {/*from ww w. j av a 2 s. com*/ super(); Control ctrl; CFLabel label; CFReferenceEditor reference; final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; setJavaFXFocusAsEnumTag(argFocus); setPadding(new Insets(5)); setHgap(5); setVgap(5); setAlignment(Pos.CENTER); ColumnConstraints column1 = new ColumnConstraints(125); ColumnConstraints column2 = new ColumnConstraints(125, 300, 500); column2.setHgrow(Priority.ALWAYS); getColumnConstraints().addAll(column1, column2); int gridRow = 0; label = getJavaFXLabelLookupDefSchema(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); reference = getJavaFXReferenceLookupDefSchema(); setHalignment(reference, HPos.LEFT); add(reference, 1, gridRow); gridRow++; label = getJavaFXLabelId(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); ctrl = getJavaFXEditorId(); setHalignment(ctrl, HPos.LEFT); add(ctrl, 1, gridRow); gridRow++; label = getJavaFXLabelEnumCode(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); ctrl = getJavaFXEditorEnumCode(); setHalignment(ctrl, HPos.LEFT); add(ctrl, 1, gridRow); gridRow++; label = getJavaFXLabelName(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); ctrl = getJavaFXEditorName(); setHalignment(ctrl, HPos.LEFT); add(ctrl, 1, gridRow); gridRow++; populateFields(); adjustComponentEnableStates(); javafxIsInitializing = false; }
From source file:net.sourceforge.msscodefactory.cfbamcustom.v2_7.CFBamCustomEditor.CFBamCustomEditorEnumTagAttrPane.java
public CFBamCustomEditorEnumTagAttrPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamEnumTagObj argFocus) {/*from w ww . j a v a 2 s. c o m*/ super(); Control ctrl; CFLabel label; CFReferenceEditor reference; final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; setJavaFXFocusAsEnumTag(argFocus); setPadding(new Insets(5)); setHgap(5); setVgap(5); setAlignment(Pos.CENTER); ColumnConstraints column1 = new ColumnConstraints(125); ColumnConstraints column2 = new ColumnConstraints(125, 300, 500); column2.setHgrow(Priority.ALWAYS); getColumnConstraints().addAll(column1, column2); int gridRow = 0; label = getJavaFXLabelId(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); ctrl = getJavaFXEditorId(); setHalignment(ctrl, HPos.LEFT); add(ctrl, 1, gridRow); gridRow++; label = getJavaFXLabelLookupDefSchema(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); reference = getJavaFXReferenceLookupDefSchema(); setHalignment(reference, HPos.LEFT); add(reference, 1, gridRow); gridRow++; label = getJavaFXLabelName(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); ctrl = getJavaFXEditorName(); setHalignment(ctrl, HPos.LEFT); add(ctrl, 1, gridRow); gridRow++; label = getJavaFXLabelEnumCode(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); ctrl = getJavaFXEditorEnumCode(); setHalignment(ctrl, HPos.LEFT); add(ctrl, 1, gridRow); gridRow++; populateFields(); adjustComponentEnableStates(); javafxIsInitializing = false; }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXSchemaRefAttrPane.java
public CFBamJavaFXSchemaRefAttrPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamSchemaRefObj argFocus) {// w w w .ja v a 2 s . c om super(); Control ctrl; CFLabel label; CFReferenceEditor reference; final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; setJavaFXFocusAsSchemaRef(argFocus); setPadding(new Insets(5)); setHgap(5); setVgap(5); setAlignment(Pos.CENTER); ColumnConstraints column1 = new ColumnConstraints(125); ColumnConstraints column2 = new ColumnConstraints(125, 300, 500); column2.setHgrow(Priority.ALWAYS); getColumnConstraints().addAll(column1, column2); int gridRow = 0; label = getJavaFXLabelLookupRefSchema(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); reference = getJavaFXReferenceLookupRefSchema(); setHalignment(reference, HPos.LEFT); add(reference, 1, gridRow); gridRow++; label = getJavaFXLabelId(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); ctrl = getJavaFXEditorId(); setHalignment(ctrl, HPos.LEFT); add(ctrl, 1, gridRow); gridRow++; label = getJavaFXLabelName(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); ctrl = getJavaFXEditorName(); setHalignment(ctrl, HPos.LEFT); add(ctrl, 1, gridRow); gridRow++; label = getJavaFXLabelRefModelName(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); ctrl = getJavaFXEditorRefModelName(); setHalignment(ctrl, HPos.LEFT); add(ctrl, 1, gridRow); gridRow++; label = getJavaFXLabelIncludeRoot(); setHalignment(label, HPos.LEFT); add(label, 0, gridRow); ctrl = getJavaFXEditorIncludeRoot(); setHalignment(ctrl, HPos.LEFT); add(ctrl, 1, gridRow); gridRow++; populateFields(); adjustComponentEnableStates(); javafxIsInitializing = false; }
From source file:mesclasses.view.RapportEleveController.java
private void drawGrid(File file) { Hyperlink link = new Hyperlink(file.getName()); link.setOnAction((event) -> openFile(file)); int rowIndex = fileGrid.addOnNewLineIfNecessary(link, 1, HPos.LEFT); ComboBox<String> typeBox = new ComboBox<>(); typeBox.getItems().addAll(Constants.FILE_TYPES); typeBox.getSelectionModel().select(selectedFileType.get()); typeBox.valueProperty().addListener((observable, oldValue, newValue) -> { if (!newValue.equals(oldValue)) { try { EleveFileUtil.moveFileForEleve(eleve, file, newValue); selectFileType(newValue); refreshGrid();//from w w w. ja v a 2s. co m } catch (IOException e) { ModalUtil.alert("Impossible de dplacer le fichier", e.getMessage()); } } }); fileGrid.add(typeBox, 2, rowIndex, null); Button deleteBtn = Btns.deleteBtn(); deleteBtn.setOnAction(event -> { if (ModalUtil.confirm("Suppression du fichier", "Etes vous sr ?")) { if (file.delete()) { fileGrid.deleteRow(SmartGrid.row(deleteBtn)); } else { ModalUtil.alert("Suppression impossible", "Impossible de supprimer le fichier " + file.getName()); } } }); fileGrid.add(deleteBtn, 3, rowIndex, null); }