List of usage examples for javafx.scene.control Label Label
public Label(String text)
From source file:eu.over9000.skadi.ui.MainWindow.java
private void setupTable() { this.table = new TableView<>(); this.liveCol = new TableColumn<>("Live"); this.liveCol.setCellValueFactory(p -> p.getValue().onlineProperty()); this.liveCol.setSortType(SortType.DESCENDING); this.liveCol.setCellFactory(p -> new LiveCell()); this.nameCol = new TableColumn<>("Channel"); this.nameCol.setCellValueFactory(p -> p.getValue().nameProperty()); this.titleCol = new TableColumn<>("Status"); this.titleCol.setCellValueFactory(p -> p.getValue().titleProperty()); this.gameCol = new TableColumn<>("Game"); this.gameCol.setCellValueFactory(p -> p.getValue().gameProperty()); this.viewerCol = new TableColumn<>("Viewer"); this.viewerCol.setCellValueFactory(p -> p.getValue().viewerProperty().asObject()); this.viewerCol.setSortType(SortType.DESCENDING); this.viewerCol.setCellFactory(p -> new RightAlignedCell<>()); this.uptimeCol = new TableColumn<>("Uptime"); this.uptimeCol.setCellValueFactory((p) -> p.getValue().uptimeProperty().asObject()); this.uptimeCol.setCellFactory(p -> new UptimeCell()); this.table.setPlaceholder(new Label("no channels added/matching the filters")); this.table.getColumns().add(this.liveCol); this.table.getColumns().add(this.nameCol); this.table.getColumns().add(this.titleCol); this.table.getColumns().add(this.gameCol); this.table.getColumns().add(this.viewerCol); this.table.getColumns().add(this.uptimeCol); this.table.getSortOrder().add(this.liveCol); this.table.getSortOrder().add(this.viewerCol); this.table.getSortOrder().add(this.nameCol); this.filteredChannelList = new FilteredList<>(this.channelHandler.getChannels()); this.sortedChannelList = new SortedList<>(this.filteredChannelList); this.sortedChannelList.comparatorProperty().bind(this.table.comparatorProperty()); this.table.setItems(this.sortedChannelList); this.table.setRowFactory(tv -> { final TableRow<Channel> row = new TableRow<>(); row.setOnMouseClicked(event -> { if ((event.getButton() == MouseButton.PRIMARY) && (event.getClickCount() == 2) && !row.isEmpty()) { this.detailChannel.set(row.getItem()); if (!this.sp.getItems().contains(this.detailPane)) { this.sp.getItems().add(this.detailPane); this.doDetailSlide(true); }// ww w .j av a2 s . c o m } }); return row; }); this.table.getSelectionModel().selectedItemProperty().addListener((obs, oldV, newV) -> { this.details.setDisable(newV == null); this.remove.setDisable(newV == null); this.chatAndStreamButton.setDisable(newV == null); this.chatAndStreamButton.resetQualities(); if ((newV == null) && this.sp.getItems().contains(this.detailPane)) { this.doDetailSlide(false); } }); }
From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java
private void createBannedIP(ListView<String> to_update) { Stage createBannedIP = new Stage(); createBannedIP.setTitle("Add Banned IP"); createBannedIP.initModality(Modality.APPLICATION_MODAL); GridPane gp = new GridPane(); gp.setPadding(new Insets(25, 25, 25, 25)); gp.setAlignment(Pos.CENTER);/*from ww w . j a v a2s .c om*/ gp.setVgap(10); gp.setHgap(10); Text title = new Text("Add Banned IP"); title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20)); gp.add(title, 0, 0, 2, 1); Label newusername = new Label("Ban IP"); TextField username = new TextField(); gp.add(newusername, 0, 1); gp.add(username, 1, 1); Button finish = new Button("Finish"); HBox finish_box = new HBox(10); finish_box.setAlignment(Pos.CENTER); finish_box.getChildren().add(finish); finish.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { banned_ips.remove(username.getText()); banned_ips.add(username.getText()); to_update.setItems(FXCollections.observableArrayList(banned_ips)); createBannedIP.close(); } }); gp.add(finish_box, 0, 2, 2, 1); Scene sc = new Scene(gp, 300, 175); createBannedIP.setScene(sc); createBannedIP.show(); }
From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualization.java
/** add a {@link Label} node to the branch container for the decluttered * axis labels// w w w . j a va 2 s. c o m * * @param labelText the string to add * @param labelWidth the width of the space to use for the label * @param labelX the horizontal position in the partPane of the text */ private synchronized void assignBranchLabel(String labelText, double labelWidth, double labelX) { Label label = new Label(labelText); label.setAlignment(Pos.CENTER); label.setTextAlignment(TextAlignment.CENTER); label.setFont(Font.font(10)); //use a leading ellipse since that is the lowest frequency part, //and can be infered more easily from other surrounding labels label.setTextOverrun(OverrunStyle.LEADING_ELLIPSIS); //force size label.setMinWidth(labelWidth); label.setPrefWidth(labelWidth); label.setMaxWidth(labelWidth); label.relocate(labelX, 0); if (labelX == 0) { // first label has no border label.setStyle("-fx-border-width: 0 0 0 0 ; -fx-border-color:black;"); // NON-NLS } else { // subsequent labels have border on left to create dividers label.setStyle("-fx-border-width: 0 0 0 1; -fx-border-color:black;"); // NON-NLS } branchPane.getChildren().add(label); }
From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualizationPane.java
/** * add a {@link Label} node to the branch container for the decluttered axis * labels// w ww .ja v a 2 s .c o m * * @param labelText the string to add * @param labelWidth the width of the space to use for the label * @param labelX the horizontal position in the partPane of the text */ private synchronized void assignBranchLabel(String labelText, double labelWidth, double labelX) { Label label = new Label(labelText); label.setAlignment(Pos.CENTER); label.setTextAlignment(TextAlignment.CENTER); label.setFont(Font.font(10)); //use a leading ellipse since that is the lowest frequency part, //and can be infered more easily from other surrounding labels label.setTextOverrun(OverrunStyle.LEADING_ELLIPSIS); //force size label.setMinWidth(labelWidth); label.setPrefWidth(labelWidth); label.setMaxWidth(labelWidth); label.relocate(labelX, 0); if (labelX == 0) { // first label has no border label.setStyle("-fx-border-width: 0 0 0 0 ; -fx-border-color:black;"); // NON-NLS //NOI18N } else { // subsequent labels have border on left to create dividers label.setStyle("-fx-border-width: 0 0 0 1; -fx-border-color:black;"); // NON-NLS //NOI18N } branchPane.getChildren().add(label); }
From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java
private void createBannedPlayername(ListView<String> to_update) { Stage createBannedPlayername = new Stage(); createBannedPlayername.setTitle("Add Banned Playername"); createBannedPlayername.initModality(Modality.APPLICATION_MODAL); GridPane gp = new GridPane(); gp.setPadding(new Insets(25, 25, 25, 25)); gp.setAlignment(Pos.CENTER);/*ww w . j ava 2s .c om*/ gp.setVgap(10); gp.setHgap(10); Text title = new Text("Add Banned Playername"); title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20)); gp.add(title, 0, 0, 2, 1); Label newusername = new Label("Ban Playername"); TextField username = new TextField(); gp.add(newusername, 0, 1); gp.add(username, 1, 1); Button finish = new Button("Finish"); HBox finish_box = new HBox(10); finish_box.setAlignment(Pos.CENTER); finish_box.getChildren().add(finish); finish.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { banned_playernames.remove(username.getText()); banned_playernames.add(username.getText()); to_update.setItems(FXCollections.observableArrayList(banned_playernames)); createBannedPlayername.close(); } }); gp.add(finish_box, 0, 2, 2, 1); Scene sc = new Scene(gp, 300, 175); createBannedPlayername.setScene(sc); createBannedPlayername.show(); }
From source file:webapptest.FXMLDocumentController.java
@FXML //DIsplays the shifts from the server public void refreshShiftsButtonPressed(ActionEvent event) { shiftList.getChildren().clear();//from w ww . ja v a2 s . c o m //get the data of employees from the server List<String> temp = new ArrayList<>(); temp.add("get_shift_specific"); String input = sendData(temp); //parse the data into an object List<Shift> shifts = parseShiftData(input); //display the headings for the employee display HBox heading = new HBox(); Label sID = new Label("Shift ID"); Label sTime = new Label("Shift Time"); Label sEmp = new Label("Shift Employee"); Label sFac = new Label("Shift House"); heading.getChildren().add(sID); heading.getChildren().add(sTime); heading.getChildren().add(sEmp); heading.getChildren().add(sFac); shiftList.getChildren().add(heading); //loop through all available employees and display to screen for (Shift s : shifts) { HBox tempLine = new HBox(); TextField sIDText = new TextField(s.getShiftID()); TextField sTimeText = new TextField(s.getShiftTime()); TextField sEmpText = new TextField(s.getEmpID()); TextField sFacText = new TextField(s.getHouseID()); tempLine.getChildren().add(sIDText); tempLine.getChildren().add(sTimeText); tempLine.getChildren().add(sEmpText); tempLine.getChildren().add(sFacText); shiftList.getChildren().add(tempLine); } }
From source file:org.sleuthkit.autopsy.timeline.ui.AbstractTimelineChart.java
/** * Add a Label Node to the contextual label container for the decluttered * axis labels.//from ww w. ja v a 2 s . co m * * @param labelText The String to add. * @param labelWidth The width, in pixels, of the space to use for the label * @param labelX The horizontal position, in pixels, in the specificPane * of the text */ private synchronized void addContextLabel(String labelText, double labelWidth, double labelX) { Label label = new Label(labelText); label.setAlignment(Pos.CENTER); label.setTextAlignment(TextAlignment.CENTER); label.setFont(Font.font(10)); //use a leading ellipse since that is the lowest frequency part, //and can be infered more easily from other surrounding labels label.setTextOverrun(OverrunStyle.LEADING_ELLIPSIS); //force size label.setMinWidth(labelWidth); label.setPrefWidth(labelWidth); label.setMaxWidth(labelWidth); label.relocate(labelX, 0); if (labelX == 0) { // first label has no border label.setBorder(null); } else { // subsequent labels have border on left to create dividers label.setBorder(ONLY_LEFT_BORDER); } contextLabelPane.getChildren().add(label); }
From source file:com.jscriptive.moneyfx.ui.chart.ChartFrame.java
public void yearlyInOutToggled(ActionEvent actionEvent) { final NumberAxis xAxis = new NumberAxis(); final CategoryAxis yAxis = new CategoryAxis(); yAxis.setLabel("In/Out in Euro"); xAxis.setLabel("Year"); final BarChart<Number, String> barChart = new BarChart<>(xAxis, yAxis); barChart.setTitle("Yearly in/out"); chartFrame.setCenter(barChart);/* w ww . ja v a 2 s . c o m*/ ToggleButton toggle = (ToggleButton) actionEvent.getTarget(); if (toggle.isSelected()) { Account account = accountCombo.getValue(); String accountLabel = getAccountLabel(account); XYChart.Series<Number, String> inSeries = new XYChart.Series<>(); inSeries.setName("In" + accountLabel); barChart.getData().add(inSeries); XYChart.Series<Number, String> outSeries = new XYChart.Series<>(); outSeries.setName("Out" + accountLabel); barChart.getData().add(outSeries); ValueRange<LocalDate> period = getTransactionOpRange(account, yearCombo.getValue()); if (period.isEmpty()) { return; } ObservableList<String> categories = FXCollections.observableArrayList(); for (int y = period.from().getYear(); y < period.to().getYear() + 6; y++) { categories.add(String.valueOf(y)); } yAxis.setCategories(categories); Service<Void> service = new Service<Void>() { @Override protected Task<Void> createTask() { return new Task<Void>() { @Override protected Void call() throws Exception { List<TransactionVolume> incomingVolumes = (account == ALL_ACCOUNTS) ? transactionRepository.getYearlyIncomingVolumes(false) : transactionRepository.getYearlyIncomingVolumesOfAccount(account, false); if (INTEGER_ZERO.compareTo(yearCombo.getValue()) < 0) { incomingVolumes = incomingVolumes.stream() .filter(v -> v.getYear().equals(yearCombo.getValue())) .sorted((v1, v2) -> v1.getDate().compareTo(v2.getDate())).collect(toList()); } for (TransactionVolume volume : incomingVolumes) { XYChart.Data<Number, String> inData = new XYChart.Data<>(volume.getVolume(), String.valueOf(volume.getYear())); Platform.runLater(() -> { inSeries.getData().add(inData); StackPane node = (StackPane) inData.getNode(); node.getChildren().add( new Label(CurrencyFormat.getInstance().format(volume.getVolume()))); node.addEventHandler(MOUSE_CLICKED, event -> handleYearlyInOutChartMouseClickEvent( (account == ALL_ACCOUNTS) ? null : account, ofYearDay(volume.getYear(), 1), event)); }); } List<TransactionVolume> outgoingVolumes = (account == ALL_ACCOUNTS) ? transactionRepository.getYearlyOutgoingVolumes(false) : transactionRepository.getYearlyOutgoingVolumesOfAccount(account, false); if (INTEGER_ZERO.compareTo(yearCombo.getValue()) < 0) { outgoingVolumes = outgoingVolumes.stream() .filter(v -> v.getYear().equals(yearCombo.getValue())) .sorted((v1, v2) -> v1.getDate().compareTo(v2.getDate())).collect(toList()); } for (TransactionVolume volume : outgoingVolumes) { XYChart.Data<Number, String> outData = new XYChart.Data<>(volume.getVolume().abs(), String.valueOf(volume.getYear())); Platform.runLater(() -> { outSeries.getData().add(outData); StackPane node = (StackPane) outData.getNode(); node.getChildren().add( new Label(CurrencyFormat.getInstance().format(volume.getVolume()))); node.addEventHandler(MOUSE_CLICKED, event -> handleYearlyInOutChartMouseClickEvent( (account == ALL_ACCOUNTS) ? null : account, ofYearDay(volume.getYear(), 1), event)); }); } return null; } }; } }; service.start(); } }
From source file:qupath.lib.gui.tma.TMASummaryViewer.java
private void initialize() { model = new TMATableModel(); groupByIDProperty.addListener((v, o, n) -> refreshTableData()); MenuBar menuBar = new MenuBar(); Menu menuFile = new Menu("File"); MenuItem miOpen = new MenuItem("Open..."); miOpen.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN)); miOpen.setOnAction(e -> {/*from www.j a v a 2 s . c o m*/ File file = QuPathGUI.getDialogHelper(stage).promptForFile(null, null, "TMA data files", new String[] { "qptma" }); if (file == null) return; setInputFile(file); }); MenuItem miSave = new MenuItem("Save As..."); miSave.setAccelerator( new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN)); miSave.setOnAction( e -> SummaryMeasurementTableCommand.saveTableModel(model, null, Collections.emptyList())); MenuItem miImportFromImage = new MenuItem("Import from current image..."); miImportFromImage.setAccelerator( new KeyCodeCombination(KeyCode.I, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN)); miImportFromImage.setOnAction(e -> setTMAEntriesFromOpenImage()); MenuItem miImportFromProject = new MenuItem("Import from current project... (experimental)"); miImportFromProject.setAccelerator( new KeyCodeCombination(KeyCode.P, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN)); miImportFromProject.setOnAction(e -> setTMAEntriesFromOpenProject()); MenuItem miImportClipboard = new MenuItem("Import from clipboard..."); miImportClipboard.setOnAction(e -> { String text = Clipboard.getSystemClipboard().getString(); if (text == null) { DisplayHelpers.showErrorMessage("Import scores", "Clipboard is empty!"); return; } int n = importScores(text); if (n > 0) { setTMAEntries(new ArrayList<>(entriesBase)); } DisplayHelpers.showMessageDialog("Import scores", "Number of scores imported: " + n); }); Menu menuEdit = new Menu("Edit"); MenuItem miCopy = new MenuItem("Copy table to clipboard"); miCopy.setOnAction(e -> { SummaryMeasurementTableCommand.copyTableContentsToClipboard(model, Collections.emptyList()); }); combinedPredicate.addListener((v, o, n) -> { // We want any other changes triggered by this to have happened, // so that the data has already been updated Platform.runLater(() -> handleTableContentChange()); }); // Reset the scores for missing cores - this ensures they will be NaN and not influence subsequent results MenuItem miResetMissingScores = new MenuItem("Reset scores for missing cores"); miResetMissingScores.setOnAction(e -> { int changes = 0; for (TMAEntry entry : entriesBase) { if (!entry.isMissing()) continue; boolean changed = false; for (String m : entry.getMeasurementNames().toArray(new String[0])) { if (!TMASummaryEntry.isSurvivalColumn(m) && !Double.isNaN(entry.getMeasurementAsDouble(m))) { entry.putMeasurement(m, null); changed = true; } } if (changed) changes++; } if (changes == 0) { logger.info("No changes made when resetting scores for missing cores!"); return; } logger.info("{} change(s) made when resetting scores for missing cores!", changes); table.refresh(); updateSurvivalCurves(); if (scatterPane != null) scatterPane.updateChart(); if (histogramDisplay != null) histogramDisplay.refreshHistogram(); }); menuEdit.getItems().add(miResetMissingScores); QuPathGUI.addMenuItems(menuFile, miOpen, miSave, null, miImportClipboard, null, miImportFromImage, miImportFromProject); menuBar.getMenus().add(menuFile); menuEdit.getItems().add(miCopy); menuBar.getMenus().add(menuEdit); menuFile.setOnShowing(e -> { boolean imageDataAvailable = QuPathGUI.getInstance() != null && QuPathGUI.getInstance().getImageData() != null && QuPathGUI.getInstance().getImageData().getHierarchy().getTMAGrid() != null; miImportFromImage.setDisable(!imageDataAvailable); boolean projectAvailable = QuPathGUI.getInstance() != null && QuPathGUI.getInstance().getProject() != null && !QuPathGUI.getInstance().getProject().getImageList().isEmpty(); miImportFromProject.setDisable(!projectAvailable); }); // Double-clicking previously used for comments... but conflicts with tree table expansion // table.setOnMouseClicked(e -> { // if (!e.isPopupTrigger() && e.getClickCount() > 1) // promptForComment(); // }); table.setPlaceholder(new Text("Drag TMA data folder onto window, or choose File -> Open")); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); BorderPane pane = new BorderPane(); pane.setTop(menuBar); menuBar.setUseSystemMenuBar(true); // Create options ToolBar toolbar = new ToolBar(); Label labelMeasurementMethod = new Label("Combination method"); labelMeasurementMethod.setLabelFor(comboMeasurementMethod); labelMeasurementMethod .setTooltip(new Tooltip("Method whereby measurements for multiple cores with the same " + TMACoreObject.KEY_UNIQUE_ID + " will be combined")); CheckBox cbHidePane = new CheckBox("Hide pane"); cbHidePane.setSelected(hidePaneProperty.get()); cbHidePane.selectedProperty().bindBidirectional(hidePaneProperty); CheckBox cbGroupByID = new CheckBox("Group by ID"); entriesBase.addListener((Change<? extends TMAEntry> event) -> { if (!event.getList().stream().anyMatch(e -> e.getMetadataValue(TMACoreObject.KEY_UNIQUE_ID) != null)) { cbGroupByID.setSelected(false); cbGroupByID.setDisable(true); } else { cbGroupByID.setDisable(false); } }); cbGroupByID.setSelected(groupByIDProperty.get()); cbGroupByID.selectedProperty().bindBidirectional(groupByIDProperty); CheckBox cbUseSelected = new CheckBox("Use selection only"); cbUseSelected.selectedProperty().bindBidirectional(useSelectedProperty); CheckBox cbSkipMissing = new CheckBox("Hide missing cores"); cbSkipMissing.selectedProperty().bindBidirectional(skipMissingCoresProperty); skipMissingCoresProperty.addListener((v, o, n) -> { table.refresh(); updateSurvivalCurves(); if (histogramDisplay != null) histogramDisplay.refreshHistogram(); updateSurvivalCurves(); if (scatterPane != null) scatterPane.updateChart(); }); toolbar.getItems().addAll(labelMeasurementMethod, comboMeasurementMethod, new Separator(Orientation.VERTICAL), cbHidePane, new Separator(Orientation.VERTICAL), cbGroupByID, new Separator(Orientation.VERTICAL), cbUseSelected, new Separator(Orientation.VERTICAL), cbSkipMissing); comboMeasurementMethod.getItems().addAll(MeasurementCombinationMethod.values()); comboMeasurementMethod.getSelectionModel().select(MeasurementCombinationMethod.MEDIAN); selectedMeasurementCombinationProperty.addListener((v, o, n) -> table.refresh()); ContextMenu popup = new ContextMenu(); MenuItem miSetMissing = new MenuItem("Set missing"); miSetMissing.setOnAction(e -> setSelectedMissingStatus(true)); MenuItem miSetAvailable = new MenuItem("Set available"); miSetAvailable.setOnAction(e -> setSelectedMissingStatus(false)); MenuItem miExpand = new MenuItem("Expand all"); miExpand.setOnAction(e -> { if (table.getRoot() == null) return; for (TreeItem<?> item : table.getRoot().getChildren()) { item.setExpanded(true); } }); MenuItem miCollapse = new MenuItem("Collapse all"); miCollapse.setOnAction(e -> { if (table.getRoot() == null) return; for (TreeItem<?> item : table.getRoot().getChildren()) { item.setExpanded(false); } }); popup.getItems().addAll(miSetMissing, miSetAvailable, new SeparatorMenuItem(), miExpand, miCollapse); table.setContextMenu(popup); table.setRowFactory(e -> { TreeTableRow<TMAEntry> row = new TreeTableRow<>(); // // Make rows invisible if they don't pass the predicate // row.visibleProperty().bind(Bindings.createBooleanBinding(() -> { // TMAEntry entry = row.getItem(); // if (entry == null || (entry.isMissing() && skipMissingCoresProperty.get())) // return false; // return entries.getPredicate() == null || entries.getPredicate().test(entry); // }, // skipMissingCoresProperty, // entries.predicateProperty())); // Style rows according to what they contain row.styleProperty().bind(Bindings.createStringBinding(() -> { if (row.isSelected()) return ""; TMAEntry entry = row.getItem(); if (entry == null || entry instanceof TMASummaryEntry) return ""; else if (entry.isMissing()) return "-fx-background-color:rgb(225,225,232)"; else return "-fx-background-color:rgb(240,240,245)"; }, row.itemProperty(), row.selectedProperty())); // row.itemProperty().addListener((v, o, n) -> { // if (n == null || n instanceof TMASummaryEntry || row.isSelected()) // row.setStyle(""); // else if (n.isMissing()) // row.setStyle("-fx-background-color:rgb(225,225,232)"); // else // row.setStyle("-fx-background-color:rgb(240,240,245)"); // }); return row; }); BorderPane paneTable = new BorderPane(); paneTable.setTop(toolbar); paneTable.setCenter(table); MasterDetailPane mdTablePane = new MasterDetailPane(Side.RIGHT, paneTable, createSidePane(), true); mdTablePane.showDetailNodeProperty().bind(Bindings.createBooleanBinding( () -> !hidePaneProperty.get() && !entriesBase.isEmpty(), hidePaneProperty, entriesBase)); mdTablePane.setDividerPosition(2.0 / 3.0); pane.setCenter(mdTablePane); model.getEntries().addListener(new ListChangeListener<TMAEntry>() { @Override public void onChanged(ListChangeListener.Change<? extends TMAEntry> c) { if (histogramDisplay != null) histogramDisplay.refreshHistogram(); updateSurvivalCurves(); if (scatterPane != null) scatterPane.updateChart(); } }); Label labelPredicate = new Label(); labelPredicate.setPadding(new Insets(5, 5, 5, 5)); labelPredicate.setAlignment(Pos.CENTER); // labelPredicate.setStyle("-fx-background-color: rgba(20, 120, 20, 0.15);"); labelPredicate.setStyle("-fx-background-color: rgba(120, 20, 20, 0.15);"); labelPredicate.textProperty().addListener((v, o, n) -> { if (n.trim().length() > 0) pane.setBottom(labelPredicate); else pane.setBottom(null); }); labelPredicate.setMaxWidth(Double.MAX_VALUE); labelPredicate.setMaxHeight(labelPredicate.getPrefHeight()); labelPredicate.setTextAlignment(TextAlignment.CENTER); predicateMeasurements.addListener((v, o, n) -> { if (n == null) labelPredicate.setText(""); else if (n instanceof TablePredicate) { TablePredicate tp = (TablePredicate) n; if (tp.getOriginalCommand().trim().isEmpty()) labelPredicate.setText(""); else labelPredicate.setText("Predicate: " + tp.getOriginalCommand()); } else labelPredicate.setText("Predicate: " + n.toString()); }); // predicate.set(new TablePredicate("\"Tumor\" > 100")); scene = new Scene(pane); scene.addEventHandler(KeyEvent.KEY_PRESSED, e -> { KeyCode code = e.getCode(); if ((code == KeyCode.SPACE || code == KeyCode.ENTER) && entrySelected != null) { promptForComment(); return; } }); }
From source file:frontend.GUIController.java
@FXML void showAbout(ActionEvent event) { /*Dialogs.create()/*from ww w . j av a 2 s . c o m*/ .title("About") .message(getLicense()) .showInformation();*/ Alert alert = new Alert(AlertType.INFORMATION); alert.initOwner(stage); alert.initModality(Modality.APPLICATION_MODAL); alert.setTitle("SAIL 1.1: About"); alert.setHeaderText("SAIL 1.1 details"); alert.setContentText("SAIL 1.1"); Label label = new Label("SAIL License details:"); TextArea textArea = new TextArea(getLicense()); textArea.setEditable(false); textArea.setWrapText(true); textArea.setMaxWidth(Double.MAX_VALUE); textArea.setMaxHeight(Double.MAX_VALUE); GridPane.setVgrow(textArea, Priority.ALWAYS); GridPane.setHgrow(textArea, Priority.ALWAYS); GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(label, 0, 0); expContent.add(textArea, 0, 1); // Set expandable Exception into the dialog pane. alert.getDialogPane().setExpandableContent(expContent); alert.showAndWait(); }