List of usage examples for javafx.scene.layout HBox setPadding
public final void setPadding(Insets value)
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private void addRow5(final Pane content, final BookingBean be) { final HBox box = new HBox(); box.setPadding(new Insets(4)); box.setFillHeight(true);//from ww w . ja v a 2 s. c o m final Text text = new Text("Welcome Mail sent: "); final CheckBox checkBox = new CheckBox(); checkBox.setSelected(be.isWelcomeMailSend()); booking2WelcomeMail.put(be, checkBox); final Text t1 = new Text(" \tPayment done: "); final CheckBox cb1 = new CheckBox(); cb1.setSelected(be.isPaymentDone()); //if (logger.isDebugEnabled()) { // logger.debug("DateOfPayment for " + be + "(" + be.hashCode() + ") is " + be.getDateOfPayment()); //} final DatePicker dp = new DatePicker(); dp.setValue(be.getDateOfPayment()); dp.setPrefWidth(140); booking2PaymentDate.put(be, dp); booking2Payment.put(be, cb1); final TextFlow tf = new TextFlow(); tf.getChildren().addAll(text, checkBox, t1, cb1, dp); box.getChildren().add(tf); if (!be.isWelcomeMailSend() || !be.isPaymentDone()) { box.getStyleClass().addAll("warning", "warning-bg"); } else { box.getStyleClass().removeAll("warning", "warning-bg"); } HBox box2 = new HBox(); box2.setPadding(new Insets(4)); box2.setFillHeight(true); TextField newPayment = new TextField(); Button addNewPaymentButton = new Button("Add payment"); addNewPaymentButton.setOnAction(e -> { addNewPayment(newPayment.getText(), be); }); box2.getChildren().addAll(newPayment, addNewPaymentButton); content.getChildren().addAll(box, box2); }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private void addRowNetEarnings(final Pane content, final BookingBean be) { final HBox box = new HBox(); box.setSpacing(boxSpacing);/*ww w.j a v a 2s. c om*/ box.setPadding(boxPadding); box.setAlignment(Pos.CENTER_LEFT); box.setFillHeight(true); final TextField grossEarningsExpression = new TextField(be.getGrossEarningsExpression()); grossEarningsExpression.setPrefWidth(prefTextInputFieldWidth * 1.5); booking2GrossEarnings.put(be, grossEarningsExpression); final Text grossEarnings = new Text(decimalFormat.format(be.getGrossEarnings())); final TextFlow tf = new TextFlow(new Text("Gross Earnings: "), grossEarningsExpression, new Text(" = "), grossEarnings, new Text("")); box.getChildren().addAll(tf); if (be.getGrossEarnings() <= 0) { box.getStyleClass().addAll("warning", "warning-bg"); } final HBox box2 = new HBox(); box2.setSpacing(boxSpacing); box2.setPadding(boxPadding); box2.setAlignment(Pos.CENTER_LEFT); box2.setFillHeight(true); Text text = new Text("Amount received: "); TextField textField = new TextField(); textField.setText(new NumberStringConverter().toString(be.getPaymentSoFar())); textField.setEditable(false); be.paymentSoFarProperty().addListener((c, o, n) -> { textField.setText(new NumberStringConverter().toString(n)); }); box2.getChildren().addAll(text, textField); content.getChildren().addAll(box, box2); }
From source file:boundary.GraphPane.java
private HBox addTransformingModeOptions() { HBox hBox = new HBox(); hBox.setPadding(new Insets(15, 12, 15, 12)); hBox.setSpacing(10);/*from ww w . j av a 2 s . c o m*/ hBox.setStyle("-fx-background-color: #66FFFF;"); final ToggleGroup optionGroup = new ToggleGroup(); Label lblMouseMode = new Label("Mouse Mode: "); lblMouseMode.setPrefSize(100, 20); RadioButton rbTransform = new RadioButton("Pan & Zoom"); rbTransform.setPrefSize(100, 20); rbTransform.setToggleGroup(optionGroup); rbTransform.setUserData("T"); rbTransform.setSelected(true); RadioButton rbPick = new RadioButton("Picking"); rbPick.setPrefSize(100, 20); rbPick.setUserData("P"); rbPick.setToggleGroup(optionGroup); optionGroup.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { @Override public void changed(ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) { if (optionGroup.getSelectedToggle() != null) { DefaultModalGraphMouse dmg = (DefaultModalGraphMouse) vv.getGraphMouse(); if (optionGroup.getSelectedToggle().getUserData().equals("T")) { dmg.setMode(Mode.TRANSFORMING); } else if (optionGroup.getSelectedToggle().getUserData().equals("P")) { dmg.setMode(Mode.PICKING); } } } }); hBox.getChildren().addAll(lblMouseMode, rbTransform, rbPick); return hBox; }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private void addRowFees(final Pane content, final BookingBean be) { final HBox box = new HBox(); // configure box box.setSpacing(8);/*from ww w. jav a 2s . c o m*/ box.setPadding(boxPadding); box.setAlignment(Pos.CENTER); box.setFillHeight(true); // add cleaning fees final TextField cleaningFeesTextField = new TextField(); Bindings.bindBidirectional(cleaningFeesTextField.textProperty(), be.cleaningFeesProperty(), new NumberStringConverter(decimalFormat)); cleaningFeesTextField.setPrefWidth(prefTextInputFieldWidth); final TextFlow cleaningFeesTextFlow = new TextFlow(new Text("Cleaning Fees: "), cleaningFeesTextField, new Text(" ")); box.getChildren().add(cleaningFeesTextFlow); // add cleaning costs final CleaningEntry ce = be.getCleaning(); if (ce != null) { final TextField cleaningCostsTextField = new TextField(); Bindings.bindBidirectional(cleaningCostsTextField.textProperty(), ce.cleaningCostsProperty(), new NumberStringConverter(decimalFormat)); cleaningCostsTextField.setPrefWidth(prefTextInputFieldWidth); final TextFlow cleaningCostsTextFlow = new TextFlow(new Text("Cleaning Costs: "), cleaningCostsTextField, new Text(" ")); box.getChildren().add(cleaningCostsTextFlow); } else { final TextField cleaningCostsTextField = new TextField("No Cleaning"); cleaningCostsTextField.setEditable(false); cleaningCostsTextField.setPrefWidth(prefTextInputFieldWidth); final TextFlow cleaningCostsTextFlow = new TextFlow(new Text("Cleaning Costs: "), cleaningCostsTextField); cleaningCostsTextField.getStyleClass().add("warning"); box.getChildren().add(cleaningCostsTextFlow); } // add service fees final TextField serviceFeesTextField = new TextField(); Bindings.bindBidirectional(serviceFeesTextField.textProperty(), be.serviceFeeProperty(), new NumberStringConverter(decimalFormat)); serviceFeesTextField.setPrefWidth(prefTextInputFieldWidth); final TextFlow serviceFeesAbsTextFlow = new TextFlow(new Text("Service Fees: "), serviceFeesTextField, new Text(" ")); box.getChildren().add(serviceFeesAbsTextFlow); // add service fees percent final TextField serviceFeesPercentTextField = new TextField(); Bindings.bindBidirectional(serviceFeesPercentTextField.textProperty(), be.serviceFeesPercentProperty(), new NumberStringConverter(decimalFormat)); serviceFeesPercentTextField.setPrefWidth(prefTextInputFieldWidth); final TextFlow serviceFeesPercentTextFlow = new TextFlow(new Text("Service Fees: "), serviceFeesPercentTextField, new Text(" %")); box.getChildren().add(serviceFeesPercentTextFlow); // add box to parent content.getChildren().add(box); }
From source file:boundary.GraphPane.java
private Node addThresholdSlider(float min, float max) { HBox hBox = new HBox(); hBox.setPadding(new Insets(15, 12, 15, 12)); hBox.setStyle("-fx-background-color: #66FFFF;"); Label lblThreshold = new Label("Threshold: "); lblThreshold.setPrefSize(100, 20);/* w ww . java 2s. c o m*/ Label lblValue = new Label("Value: "); lblValue.setPrefSize(50, 20); TextField tfValue = new TextField(String.valueOf(min)); Slider thresholdSlider = new Slider(); thresholdSlider.setMin(Math.floor(min)); thresholdSlider.setMax(Math.ceil(max)); thresholdSlider.setMajorTickUnit(Math.ceil((max - min) / 5)); thresholdSlider.setMinorTickCount(1); thresholdSlider.setBlockIncrement(1); thresholdSlider.setSnapToTicks(true); thresholdSlider.setShowTickMarks(true); thresholdSlider.valueProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { edgePredicate.setThreshold(newValue.floatValue()); vertexPredicate.setThreshold(newValue.floatValue()); vv.repaint(); tfValue.setText(String.format(Locale.US, "%.2f", newValue.floatValue())); } }); tfValue.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { float value; try { value = Float.parseFloat(tfValue.getText()); } catch (Exception ex) { value = 0; } edgePredicate.setThreshold(value); vertexPredicate.setThreshold(value); vv.repaint(); thresholdSlider.setValue(value); } }); Label lblSearch = new Label("Search: "); lblSearch.setPrefSize(70, 20); TextField tf = new TextField(); tf.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { String toFind = tf.getText().toLowerCase(); for (NodeInfo nodeInfo : nodesHighlighted) nodeInfo.setHighlighted(false); if (nodesHighlighted.size() > 0) { nodesHighlighted.clear(); vv.repaint(); } if (toFind.length() > 2) { for (NodeInfo nodeInfo : nodes.values()) { if (nodeInfo.getUserData().toLowerCase().contains((toFind))) { nodeInfo.setHighlighted(true); nodesHighlighted.add(nodeInfo); } } if (nodesHighlighted.size() == 1) { Layout<String, String> layout = vv.getGraphLayout(); Point2D q = layout.transform(nodesHighlighted.get(0).id); Point2D lvc = vv.getRenderContext().getMultiLayerTransformer() .inverseTransform(vv.getCenter()); final double dx = (lvc.getX() - q.getX()) / 10; final double dy = (lvc.getY() - q.getY()) / 10; Runnable animator = new Runnable() { public void run() { for (int i = 0; i < 10; i++) { vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT) .translate(dx, dy); try { Thread.sleep(100); } catch (InterruptedException ex) { } } } }; Thread thread = new Thread(animator); thread.start(); } vv.repaint(); } } }); hBox.getChildren().addAll(lblThreshold, thresholdSlider, lblValue, tfValue, lblSearch, tf); return hBox; }
From source file:org.sleuthkit.autopsy.timeline.ui.detailview.AggregateEventNode.java
public AggregateEventNode(final AggregateEvent event, AggregateEventNode parentEventNode, EventDetailChart chart) {/*from www . j a v a2 s .c om*/ this.event = event; descLOD.set(event.getLOD()); this.parentEventNode = parentEventNode; this.chart = chart; final Region region = new Region(); HBox.setHgrow(region, Priority.ALWAYS); final HBox hBox = new HBox(descrLabel, countLabel, region, minusButton, plusButton); hBox.setPrefWidth(USE_COMPUTED_SIZE); hBox.setMinWidth(USE_PREF_SIZE); hBox.setPadding(new Insets(2, 5, 2, 5)); hBox.setAlignment(Pos.CENTER_LEFT); minusButton.setVisible(false); plusButton.setVisible(false); minusButton.setManaged(false); plusButton.setManaged(false); final BorderPane borderPane = new BorderPane(subNodePane, hBox, null, null, null); BorderPane.setAlignment(subNodePane, Pos.TOP_LEFT); borderPane.setPrefWidth(USE_COMPUTED_SIZE); getChildren().addAll(spanRegion, borderPane); setAlignment(Pos.TOP_LEFT); setMinHeight(24); minWidthProperty().bind(spanRegion.widthProperty()); setPrefHeight(USE_COMPUTED_SIZE); setMaxHeight(USE_PREF_SIZE); //set up subnode pane sizing contraints subNodePane.setPrefHeight(USE_COMPUTED_SIZE); subNodePane.setMinHeight(USE_PREF_SIZE); subNodePane.setMinWidth(USE_PREF_SIZE); subNodePane.setMaxHeight(USE_PREF_SIZE); subNodePane.setMaxWidth(USE_PREF_SIZE); subNodePane.setPickOnBounds(false); //setup description label eventTypeImageView.setImage(event.getType().getFXImage()); descrLabel.setGraphic(eventTypeImageView); descrLabel.setPrefWidth(USE_COMPUTED_SIZE); descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS); descrLabel.setMouseTransparent(true); setDescriptionVisibility(chart.getDescrVisibility().get()); //setup backgrounds final Color evtColor = event.getType().getColor(); spanFill = new Background( new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY)); setBackground( new Background(new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY))); setCursor(Cursor.HAND); spanRegion.setStyle("-fx-border-width:2 0 2 2; -fx-border-radius: 2; -fx-border-color: " + ColorUtilities.getRGBCode(evtColor) + ";"); // NON-NLS spanRegion.setBackground(spanFill); //set up mouse hover effect and tooltip setOnMouseEntered((MouseEvent e) -> { //defer tooltip creation till needed, this had a surprisingly large impact on speed of loading the chart installTooltip(); spanRegion.setEffect(new DropShadow(10, evtColor)); minusButton.setVisible(true); plusButton.setVisible(true); minusButton.setManaged(true); plusButton.setManaged(true); toFront(); }); setOnMouseExited((MouseEvent e) -> { spanRegion.setEffect(null); minusButton.setVisible(false); plusButton.setVisible(false); minusButton.setManaged(false); plusButton.setManaged(false); }); setOnMouseClicked(new EventMouseHandler()); plusButton.disableProperty().bind(descLOD.isEqualTo(DescriptionLOD.FULL)); minusButton.disableProperty().bind(descLOD.isEqualTo(event.getLOD())); plusButton.setOnMouseClicked(e -> { final DescriptionLOD next = descLOD.get().next(); if (next != null) { loadSubClusters(next); descLOD.set(next); } }); minusButton.setOnMouseClicked(e -> { final DescriptionLOD previous = descLOD.get().previous(); if (previous != null) { loadSubClusters(previous); descLOD.set(previous); } }); }
From source file:gov.va.isaac.sync.view.SyncView.java
private void initGui() { root_ = new BorderPane(); root_.setPrefWidth(550);//ww w. j av a2 s.c o m VBox titleBox = new VBox(); Label title = new Label("Datastore Synchronization"); title.getStyleClass().add("titleLabel"); title.setAlignment(Pos.CENTER); title.setMaxWidth(Double.MAX_VALUE); title.setPadding(new Insets(10)); titleBox.getChildren().add(title); titleBox.getStyleClass().add("headerBackground"); url_ = AppContext.getAppConfiguration().getCurrentChangeSetUrl(); String urlType = AppContext.getAppConfiguration().getChangeSetUrlTypeName(); String syncUsername = ExtendedAppContext.getCurrentlyLoggedInUserProfile().getSyncUsername(); if (StringUtils.isBlank(syncUsername)) { syncUsername = ExtendedAppContext.getCurrentlyLoggedInUser(); } url_ = syncService_.substituteURL(url_, syncUsername); Label info = new CopyableLabel("Sync using " + urlType + ": " + url_); info.setTooltip(new Tooltip(url_)); titleBox.getChildren().add(info); titleBox.setPadding(new Insets(5, 5, 5, 5)); root_.setTop(titleBox); VBox centerContent = new VBox(); centerContent.setFillWidth(true); centerContent.setPrefWidth(Double.MAX_VALUE); centerContent.setPadding(new Insets(10)); centerContent.getStyleClass().add("itemBorder"); centerContent.setSpacing(10.0); centerContent.getChildren().add(new Label("Status:")); summary_ = new TextArea(); summary_.setWrapText(true); summary_.setEditable(false); summary_.setMaxWidth(Double.MAX_VALUE); summary_.setMaxHeight(Double.MAX_VALUE); summary_.setPrefHeight(150.0); centerContent.getChildren().add(summary_); VBox.setVgrow(summary_, Priority.ALWAYS); pb_ = new ProgressBar(0.0); pb_.setPrefHeight(20); pb_.setMaxWidth(Double.MAX_VALUE); centerContent.getChildren().add(pb_); root_.setCenter(centerContent); //Bottom buttons HBox buttons = new HBox(); buttons.setMaxWidth(Double.MAX_VALUE); buttons.setAlignment(Pos.CENTER); buttons.setPadding(new Insets(5)); buttons.setSpacing(30); Button cancel = new Button("Close"); cancel.setOnAction((action) -> { if (running_.get()) { addLine("Cancelling..."); cancel.setDisable(true); cancelRequested_ = true; } else { cancel.getScene().getWindow().hide(); root_ = null; } }); buttons.getChildren().add(cancel); Button action = new Button("Synchronize"); action.disableProperty().bind(running_); action.setOnAction((theAction) -> { summary_.setText(""); pb_.setProgress(-1.0); running_.set(true); Utility.execute(() -> sync()); }); buttons.getChildren().add(action); cancel.minWidthProperty().bind(action.widthProperty()); running_.addListener(change -> { if (running_.get()) { cancel.setText("Cancel"); } else { cancel.setText("Close"); } cancel.setDisable(false); }); root_.setBottom(buttons); }
From source file:Main.java
private TitledPane getEffectTitledPane() { noneEffect.setToggleGroup(effectGroup); noneEffect.setSelected(true);/* w w w. j a v a 2 s .c o m*/ dropshadowEffect.setToggleGroup(effectGroup); reflectionEffect.setToggleGroup(effectGroup); glowEffect.setToggleGroup(effectGroup); HBox hBox = new HBox(); hBox.setPadding(new Insets(5, 5, 5, 5)); hBox.getChildren().addAll(noneEffect, dropshadowEffect, reflectionEffect, glowEffect); TitledPane effectsPane = new TitledPane("Effect", hBox); return effectsPane; }
From source file:UI.MainStageController.java
/** * shows the correlation table in the analysis view *///from ww w . j a va2s .c o m @FXML private void displayCorrelationTable() { //Delete whatever's been in the table before TableView<String[]> analysisTable = new TableView<>(); //We want to display correlations and p-Values of every node combination double[][] correlationMatrix = AnalysisData.getCorrelationMatrix().getData(); double[][] pValueMatrix = AnalysisData.getPValueMatrix().getData(); LinkedList<TaxonNode> taxonList = SampleComparison.getUnifiedTaxonList(LoadedData.getSamplesToAnalyze(), AnalysisData.getLevelOfAnalysis()); //Table will consist of strings String[][] tableValues = new String[correlationMatrix.length][correlationMatrix[0].length + 1]; //Add the values as formatted strings for (int i = 0; i < tableValues.length; i++) { tableValues[i][0] = taxonList.get(i).getName(); for (int j = 1; j < tableValues[0].length; j++) { tableValues[i][j] = String.format("%.3f", correlationMatrix[i][j - 1]).replace(",", ".") + "\n(" + String.format("%.2f", pValueMatrix[i][j - 1]).replace(",", ".") + ")"; } } for (int i = 0; i < tableValues[0].length; i++) { String columnTitle; if (i > 0) { columnTitle = taxonList.get(i - 1).getName(); } else { columnTitle = ""; } TableColumn<String[], String> column = new TableColumn<>(columnTitle); final int columnIndex = i; column.setCellValueFactory(cellData -> { String[] row = cellData.getValue(); return new SimpleStringProperty(row[columnIndex]); }); analysisTable.getColumns().add(column); //First column contains taxon names and should be italic if (i == 0) column.setStyle("-fx-font-style:italic;"); } for (int i = 0; i < tableValues.length; i++) { analysisTable.getItems().add(tableValues[i]); } //Display table on a new stage Stage tableStage = new Stage(); tableStage.setTitle("Correlation Table"); BorderPane tablePane = new BorderPane(); Button exportCorrelationsButton = new Button("Save correlation table to CSV"); Button exportPValuesButton = new Button("Save p-value table to CSV"); exportCorrelationsButton.setOnAction(e -> exportTableToCSV(tableValues, false)); exportPValuesButton.setOnAction(e -> exportTableToCSV(tableValues, true)); HBox exportBox = new HBox(exportCorrelationsButton, exportPValuesButton); exportBox.setPadding(new Insets(10)); exportBox.setSpacing(10); tablePane.setTop(exportBox); tablePane.setCenter(analysisTable); Scene tableScene = new Scene(tablePane); tableStage.setScene(tableScene); tableStage.show(); }
From source file:tachyon.view.ProjectProperties.java
public ProjectProperties(JavaProject project, Window w) { this.project = project; stage = new Stage(); stage.initOwner(w);//from ww w . j a v a 2s .com stage.initModality(Modality.APPLICATION_MODAL); stage.setWidth(600); stage.setTitle("Project Properties - " + project.getProjectName()); stage.getIcons().add(tachyon.Tachyon.icon); stage.setResizable(false); HBox mai, libs, one, two, thr, fou; ListView<String> compileList, runtimeList; Button compileAdd, compileRemove, preview, selectIm, runtimeAdd, runtimeRemove; TextField iconField; stage.setScene(new Scene(new VBox(5, pane = new TabPane( new Tab("Library Settings", box1 = new VBox(15, libs = new HBox(10, new Label("External Libraries"), libsView = new ListView<>(), new VBox(5, addJar = new Button("Add Jar"), removeJar = new Button("Remove Jar"))))), new Tab("Program Settings", new ScrollPane(box2 = new VBox(15, one = new HBox(10, new Label("Main-Class"), mainClass = new TextField(project.getMainClassName()), select = new Button("Select")), two = new HBox(10, new Label("Compile-Time Arguments"), compileList = new ListView<>(), new VBox(5, compileAdd = new Button("Add Argument"), compileRemove = new Button("Remove Argument")))))), new Tab("Deployment Settings", box3 = new VBox(15, thr = new HBox(10, new Label("Icon File"), iconField = new TextField(project.getFileIconPath()), preview = new Button("Preview Image"), selectIm = new Button("Select Icon")), fou = new HBox(10, new Label("Runtime Arguments"), runtimeList = new ListView<>(), new VBox(5, runtimeAdd = new Button("Add Argument"), runtimeRemove = new Button("Remove Argument")))))), new VBox(15, mai = new HBox(10, cancel = new Button("Cancel"), confirm = new Button("Confirm")))))); if (applyCss.get()) { stage.getScene().getStylesheets().add(css); } for (Tab b : pane.getTabs()) { b.setClosable(false); } mainClass.setPromptText("Main-Class"); box1.setPadding(new Insets(5, 10, 5, 10)); mai.setAlignment(Pos.CENTER_RIGHT); mai.setPadding(box1.getPadding()); libs.setAlignment(Pos.CENTER); one.setAlignment(Pos.CENTER); two.setAlignment(Pos.CENTER); thr.setAlignment(Pos.CENTER); fou.setAlignment(Pos.CENTER); box1.setAlignment(Pos.CENTER); box2.setPadding(box1.getPadding()); box2.setAlignment(Pos.CENTER); box3.setPadding(box1.getPadding()); box3.setAlignment(Pos.CENTER); mainClass.setEditable(false); mainClass.setPrefWidth(200); for (JavaLibrary lib : project.getAllLibs()) { libsView.getItems().add(lib.getBinaryAbsolutePath()); } for (String sa : project.getCompileTimeArguments().keySet()) { compileList.getItems().add(sa + ":" + project.getCompileTimeArguments().get(sa)); } for (String sa : project.getRuntimeArguments()) { runtimeList.getItems().add(sa); } compileAdd.setOnAction((e) -> { Dialog<Pair<String, String>> dialog = new Dialog<>(); dialog.setTitle("Compiler Argument"); dialog.initOwner(stage); dialog.setHeaderText("Entry the argument"); ButtonType loginButtonType = new ButtonType("Done", ButtonData.OK_DONE); dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL); GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(20, 150, 10, 10)); TextField username = new TextField(); username.setPromptText("Key"); TextField password = new TextField(); password.setPromptText("Value"); grid.add(new Label("Key:"), 0, 0); grid.add(username, 1, 0); grid.add(new Label("Value:"), 0, 1); grid.add(password, 1, 1); Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType); loginButton.setDisable(true); username.textProperty().addListener((observable, oldValue, newValue) -> { loginButton.setDisable(newValue.trim().isEmpty()); }); dialog.getDialogPane().setContent(grid); Platform.runLater(() -> username.requestFocus()); dialog.setResultConverter(dialogButton -> { if (dialogButton == loginButtonType) { return new Pair<>(username.getText(), password.getText()); } return null; }); Optional<Pair<String, String>> result = dialog.showAndWait(); if (result.isPresent()) { compileList.getItems().add(result.get().getKey() + ":" + result.get().getValue()); } }); compileRemove.setOnAction((e) -> { if (compileList.getSelectionModel().getSelectedItem() != null) { compileList.getItems().remove(compileList.getSelectionModel().getSelectedItem()); } }); runtimeAdd.setOnAction((e) -> { TextInputDialog dia = new TextInputDialog(); dia.setTitle("Add Runtime Argument"); dia.setHeaderText("Enter an argument"); dia.initOwner(stage); Optional<String> res = dia.showAndWait(); if (res.isPresent()) { runtimeList.getItems().add(res.get()); } }); runtimeRemove.setOnAction((e) -> { if (runtimeList.getSelectionModel().getSelectedItem() != null) { runtimeList.getItems().remove(runtimeList.getSelectionModel().getSelectedItem()); } }); preview.setOnAction((e) -> { if (!iconField.getText().isEmpty()) { if (iconField.getText().endsWith(".ico")) { List<BufferedImage> read = new ArrayList<>(); try { read.addAll(ICODecoder.read(new File(iconField.getText()))); } catch (IOException ex) { } if (read.size() >= 1) { Image im = SwingFXUtils.toFXImage(read.get(0), null); Stage st = new Stage(); st.initOwner(stage); st.initModality(Modality.APPLICATION_MODAL); st.setTitle("Icon Preview"); st.getIcons().add(Tachyon.icon); st.setScene(new Scene(new BorderPane(new ImageView(im)))); if (applyCss.get()) { st.getScene().getStylesheets().add(css); } st.showAndWait(); } } else if (iconField.getText().endsWith(".icns")) { try { BufferedImage ima = Imaging.getBufferedImage(new File(iconField.getText())); if (ima != null) { Image im = SwingFXUtils.toFXImage(ima, null); Stage st = new Stage(); st.initOwner(stage); st.initModality(Modality.APPLICATION_MODAL); st.setTitle("Icon Preview"); st.getIcons().add(Tachyon.icon); st.setScene(new Scene(new BorderPane(new ImageView(im)))); if (applyCss.get()) { st.getScene().getStylesheets().add(css); } st.showAndWait(); } } catch (ImageReadException | IOException ex) { } } else { Image im = new Image(new File(iconField.getText()).toURI().toString()); Stage st = new Stage(); st.initOwner(stage); st.initModality(Modality.APPLICATION_MODAL); st.setTitle("Icon Preview"); st.getIcons().add(Tachyon.icon); st.setScene(new Scene(new BorderPane(new ImageView(im)))); if (applyCss.get()) { st.getScene().getStylesheets().add(css); } st.showAndWait(); } } }); selectIm.setOnAction((e) -> { FileChooser fc = new FileChooser(); fc.setTitle("Icon File"); String OS = System.getProperty("os.name").toLowerCase(); fc.getExtensionFilters().add(new ExtensionFilter("Icon File", OS.contains("win") ? getWindowsImageExtensions() : getMacImageExtensions())); fc.setSelectedExtensionFilter(fc.getExtensionFilters().get(0)); File lf = fc.showOpenDialog(stage); if (lf != null) { iconField.setText(lf.getAbsolutePath()); } }); addJar.setOnAction((e) -> { FileChooser f = new FileChooser(); f.setTitle("External Libraries"); f.setSelectedExtensionFilter(new ExtensionFilter("Jar Files", "*.jar")); List<File> showOpenMultipleDialog = f.showOpenMultipleDialog(stage); if (showOpenMultipleDialog != null) { for (File fi : showOpenMultipleDialog) { if (!libsView.getItems().contains(fi.getAbsolutePath())) { libsView.getItems().add(fi.getAbsolutePath()); } } } }); removeJar.setOnAction((e) -> { String selected = libsView.getSelectionModel().getSelectedItem(); if (selected != null) { libsView.getItems().remove(selected); } }); select.setOnAction((e) -> { List<String> all = getAll(); ChoiceDialog<String> di = new ChoiceDialog<>(project.getMainClassName(), all); di.setTitle("Select Main Class"); di.initOwner(stage); di.setHeaderText("Select A Main Class"); Optional<String> show = di.showAndWait(); if (show.isPresent()) { mainClass.setText(show.get()); } }); cancel.setOnAction((e) -> { stage.close(); }); confirm.setOnAction((e) -> { project.setMainClassName(mainClass.getText()); project.setFileIconPath(iconField.getText()); project.setRuntimeArguments(runtimeList.getItems()); HashMap<String, String> al = new HashMap<>(); for (String s : compileList.getItems()) { String[] spl = s.split(":"); al.put(spl[0], spl[1]); } project.setCompileTimeArguments(al); project.setAllLibs(libsView.getItems()); stage.close(); }); }