List of usage examples for javafx.geometry Pos TOP_RIGHT
Pos TOP_RIGHT
To view the source code for javafx.geometry Pos TOP_RIGHT.
Click Source Link
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 av a 2 s . c om*/ 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:cz.lbenda.gui.controls.TextAreaFrmController.java
/** Create button which can open text editor */ public static Button createOpenButton(String windowTitle, @Nonnull Supplier<String> oldValueSupplier, @Nonnull Consumer<String> newValueConsumer) { String title = windowTitle == null ? msgDefaultWindowTitle : windowTitle; Button result = new Button(null, new ImageView(BUTTON_IMAGE)); result.setTooltip(new Tooltip(msgBtnOpenInEditor_tooltip)); BorderPane.setAlignment(result, Pos.TOP_RIGHT); result.setOnAction(event -> {//from ww w. j av a2 s . c o m Tuple2<Parent, TextAreaFrmController> tuple2 = TextAreaFrmController.createNewInstance(); tuple2.get2().textProperty().setValue(oldValueSupplier.get()); tuple2.get2().textProperty() .addListener((observable, oldValue, newValue) -> newValueConsumer.accept(newValue)); Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); DialogHelper.getInstance().openWindowInCenterOfStage(stage, tuple2.get2().getMainPane(), title); }); return result; }
From source file:ui.main.MainViewController.java
private synchronized void paintSendMessage(String msg, String time) { Task<HBox> recievedMessages = new Task<HBox>() { @Override/*from w ww. j ava 2 s . c o m*/ protected HBox call() throws Exception { VBox vbox = new VBox(); //to add text ImageView imageRec = new ImageView(myAvatar.getImage()); imageRec.setFitHeight(60); imageRec.setFitWidth(50); Label myName = new Label(name.getText()); myName.setDisable(true); Label timeL = new Label(time); timeL.setDisable(true); timeL.setFont(new Font("Arial", 10)); BubbledLabel bbl = new BubbledLabel(); bbl.setText(msg); bbl.setBackground(new Background(new BackgroundFill(Color.LIGHTBLUE, null, null))); HBox hbox = new HBox(); hbox.setAlignment(Pos.TOP_RIGHT); bbl.setBubbleSpec(BubbleSpec.FACE_RIGHT_CENTER); vbox.getChildren().addAll(myName, bbl, timeL); hbox.getChildren().addAll(vbox, imageRec); return hbox; } }; recievedMessages.setOnSucceeded(event -> { chatList.getChildren().add(recievedMessages.getValue()); }); Thread t = new Thread(recievedMessages); t.setDaemon(true); t.start(); try { t.join(); } catch (InterruptedException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } }