javafx.scene.control.ContentDisplay Java Examples
The following examples show how to use
javafx.scene.control.ContentDisplay.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapSelection.java From triplea with GNU General Public License v3.0 | 6 votes |
private Node createMapListing(final GameChooserEntry gameChooserEntry) { final var button = new Button(gameChooserEntry.getGameName()); // TODO Placeholder image, ship with engine // or implement real map thumbnails final var imageView = new ImageView(new Image("https://triplea-game.org/images/missing_map.png", true)); imageView.setPreserveRatio(true); imageView.setFitHeight(150); imageView.setFitWidth(170); button.setGraphic(imageView); button.setWrapText(true); button.setPrefSize(200, 200); button.setContentDisplay(ContentDisplay.TOP); button.setOnAction( event -> { selectedGame = gameChooserEntry; selectButton.setDisable(false); detailsButton.setDisable(false); mapContainer.getChildren().forEach(node -> node.getStyleClass().remove("selected")); button.getStyleClass().add("selected"); }); return button; }
Example #2
Source File: MessAccountantController.java From Hostel-Management-System with MIT License | 6 votes |
@Override public void startEdit() { super.startEdit(); if (textField == null) { createTextField(); } setGraphic(textField); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); Platform.runLater(new Runnable() { @Override public void run() { textField.requestFocus(); textField.selectAll(); } }); }
Example #3
Source File: ItemListCell.java From oim-fx with MIT License | 6 votes |
public ItemListCell(ExecuteAction executeAction, final StringConverter<T> converter) { setConverter(converter); this.executeAction = executeAction; this.button = new Button(); button.getStyleClass().clear(); button.setMinHeight(20); button.setMinWidth(20); //Image image = ImageBox.getImageClassPath("/resources/common/imagse/close/1_cancel_button_hover.png"); //button.setGraphic(new ImageView(image)); button.setText("X"); setAlignment(Pos.CENTER_LEFT); setContentDisplay(ContentDisplay.LEFT); setGraphic(null); }
Example #4
Source File: ChooseMacroDialog.java From arma-dialog-creator with MIT License | 6 votes |
public BasicMacroItemCategory() { final double height = 100; VBox vb = new VBox(10); categoryNode = vb; ResourceBundle bundle = Lang.ApplicationBundle(); taComment.setPrefHeight(height); taComment.setEditable(false); Label lblComment = new Label(bundle.getString("Macros.comment"), taComment); lblComment.setContentDisplay(ContentDisplay.BOTTOM); taValue.setEditable(false); taValue.setPrefHeight(height); Label lblValue = new Label(bundle.getString("Macros.value"), taValue); lblValue.setContentDisplay(ContentDisplay.BOTTOM); lblMacroPropertyType = new Label(String.format(bundle.getString("Popups.ChooseMacro.property_type"), "?")); vb.getChildren().addAll(lblValue, lblComment, lblMacroPropertyType); }
Example #5
Source File: PacketHex.java From trex-stateless-gui with Apache License 2.0 | 6 votes |
/** * * @param item * @param empty */ @Override protected void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (!empty) { // Show the Text Field this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); ObservableValue<String> ov = getTableColumn().getCellObservableValue(getIndex()); SimpleStringProperty sp = (SimpleStringProperty) ov; if (this.boundToCurrently == null) { this.boundToCurrently = sp; this.textField.textProperty().bindBidirectional(sp); } else if (this.boundToCurrently != sp) { this.textField.textProperty().unbindBidirectional(this.boundToCurrently); this.boundToCurrently = sp; this.textField.textProperty().bindBidirectional(this.boundToCurrently); } } else { this.setContentDisplay(ContentDisplay.TEXT_ONLY); } }
Example #6
Source File: OpcUaTrendController.java From OEE-Designer with MIT License | 6 votes |
@Override protected void setImages() throws Exception { super.setImages(); // connect btConnect.setGraphic(ImageManager.instance().getImageView(Images.CONNECT)); btConnect.setContentDisplay(ContentDisplay.LEFT); // disconnect btDisconnect.setGraphic(ImageManager.instance().getImageView(Images.DISCONNECT)); btDisconnect.setContentDisplay(ContentDisplay.LEFT); // cancel connect btCancelConnect.setGraphic(ImageManager.instance().getImageView(Images.CANCEL)); btCancelConnect.setContentDisplay(ContentDisplay.LEFT); }
Example #7
Source File: ControlStyle.java From MyBox with Apache License 2.0 | 6 votes |
public static ContentDisplay getControlContent(String value) { if (value == null) { return ContentDisplay.GRAPHIC_ONLY; } switch (value.toLowerCase()) { case "graphic": return ContentDisplay.GRAPHIC_ONLY; case "text": return ContentDisplay.TEXT_ONLY; case "top": return ContentDisplay.TOP; case "left": return ContentDisplay.LEFT; case "right": return ContentDisplay.RIGHT; case "bottom": return ContentDisplay.BOTTOM; case "center": return ContentDisplay.CENTER; default: return ContentDisplay.GRAPHIC_ONLY; } }
Example #8
Source File: OpcDaTrendController.java From OEE-Designer with MIT License | 6 votes |
@Override protected void setImages() throws Exception { super.setImages(); // connect btConnect.setGraphic(ImageManager.instance().getImageView(Images.CONNECT)); btConnect.setContentDisplay(ContentDisplay.RIGHT); // disconnect btDisconnect.setGraphic(ImageManager.instance().getImageView(Images.DISCONNECT)); btDisconnect.setContentDisplay(ContentDisplay.RIGHT); // cancel connect btCancelConnect.setGraphic(ImageManager.instance().getImageView(Images.CANCEL)); btCancelConnect.setContentDisplay(ContentDisplay.RIGHT); }
Example #9
Source File: ColorTableCell.java From mzmine2 with GNU General Public License v2.0 | 6 votes |
public ColorTableCell(TableColumn<T, Color> column) { colorPicker = new ColorPicker(); colorPicker.editableProperty().bind(column.editableProperty()); colorPicker.disableProperty().bind(column.editableProperty().not()); colorPicker.setOnShowing(event -> { final TableView<T> tableView = getTableView(); tableView.getSelectionModel().select(getTableRow().getIndex()); tableView.edit(tableView.getSelectionModel().getSelectedIndex(), column); }); colorPicker.valueProperty() .addListener((observable, oldValue, newValue) -> { commitEdit(newValue); }); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); }
Example #10
Source File: TooltippedTextFieldTableCell.java From pdfsam with GNU Affero General Public License v3.0 | 6 votes |
@Override public void commitEdit(String item) { // This block is necessary to support commit on losing focus, because the baked-in mechanism // sets our editing state to false before we can intercept the loss of focus. // The default commitEdit(...) method simply bails if we are not editing... if (!isEditing() && !item.equals(getItem())) { TableView<SelectionTableRowData> table = getTableView(); if (table != null) { TableColumn<SelectionTableRowData, String> column = getTableColumn(); CellEditEvent<SelectionTableRowData, String> event = new CellEditEvent<>(table, new TablePosition<>(table, getIndex(), column), TableColumn.editCommitEvent(), item); Event.fireEvent(column, event); } } super.commitEdit(item); setContentDisplay(ContentDisplay.TEXT_ONLY); }
Example #11
Source File: BooleanCell.java From Quelea with GNU General Public License v3.0 | 6 votes |
public BooleanCell() { checkBox = new CheckBox(); checkBox.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if(isEditing()) { commitEdit(newValue == null ? false : newValue); } } }); this.setGraphic(checkBox); this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); this.setEditable(true); }
Example #12
Source File: GenericEditableTableCell.java From JFoenix with Apache License 2.0 | 6 votes |
@Override public void updateItem(T item, boolean empty) { super.updateItem(item, empty); if (empty) { setText(null); setGraphic(null); } else { if (isEditing()) { if (editorNode != null) { builder.setValue(getValue()); } setGraphic(editorNode); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); builder.updateItem(item, empty); } else { Object value = getValue(); if (value instanceof Node) { setGraphic((Node) value); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } else { setText(value == null ? null : String.valueOf(value)); setContentDisplay(ContentDisplay.TEXT_ONLY); } } } }
Example #13
Source File: HeadingPane.java From constellation with Apache License 2.0 | 6 votes |
/** * Primary constructor. * * @param headingText Text to display * @param plugins Plug-ins to include * @param top a component (e.g. the parent in the layout tree) which should * be informed when plug-ins are selected or deselected. * @param globalParamLabels the labels of the global parameters. */ public HeadingPane(String headingText, List<DataAccessPlugin> plugins, PluginParametersPaneListener top, final Set<String> globalParamLabels) { this.top = top; boxes.setHgap(5); plugins.stream().forEach(_item -> boxes.getChildren().add(makeInactiveSquare())); setText(headingText); setGraphic(boxes); setContentDisplay(ContentDisplay.RIGHT); setGraphicTextGap(5); setCollapsible(true); setExpanded(DataAccessPreferences.isExpanded(headingText, true)); getStyleClass().add("titled-pane-heading"); VBox sources = new VBox(); sources.setPadding(Insets.EMPTY); setContent(sources); for (DataAccessPlugin plugin : plugins) { final DataSourceTitledPane dataSourcePane = new DataSourceTitledPane(plugin, null, this, globalParamLabels); dataSources.add(dataSourcePane); sources.getChildren().add(dataSourcePane); } expandedProperty().addListener((ChangeListener) (final ObservableValue observable, final Object oldValue, final Object newValue) -> DataAccessPreferences.setExpanded(headingText, (boolean) newValue)); }
Example #14
Source File: PhysicalModelController.java From OEE-Designer with MIT License | 6 votes |
protected void setImages() throws Exception { // new entity btNew.setGraphic(ImageManager.instance().getImageView(Images.NEW)); btNew.setContentDisplay(ContentDisplay.RIGHT); // save entity btSave.setGraphic(ImageManager.instance().getImageView(Images.SAVE)); btSave.setContentDisplay(ContentDisplay.RIGHT); // save all btRefresh.setGraphic(ImageManager.instance().getImageView(Images.REFRESH)); btRefresh.setContentDisplay(ContentDisplay.RIGHT); // delete entity btDelete.setGraphic(ImageManager.instance().getImageView(Images.DELETE)); btDelete.setContentDisplay(ContentDisplay.RIGHT); // dashboard btDashboard.setGraphic(ImageManager.instance().getImageView(Images.DASHBOARD)); btDashboard.setContentDisplay(ContentDisplay.RIGHT); // context menu miSaveAll.setGraphic(ImageManager.instance().getImageView(Images.SAVE_ALL)); miRefreshAll.setGraphic(ImageManager.instance().getImageView(Images.REFRESH_ALL)); miClearSelection.setGraphic(ImageManager.instance().getImageView(Images.CLEAR)); }
Example #15
Source File: FileShareController.java From OEE-Designer with MIT License | 6 votes |
@Override protected void setImages() throws Exception { super.setImages(); // new btNew.setGraphic(ImageManager.instance().getImageView(Images.NEW)); btNew.setContentDisplay(ContentDisplay.LEFT); // save btSave.setGraphic(ImageManager.instance().getImageView(Images.SAVE)); btSave.setContentDisplay(ContentDisplay.LEFT); // delete btDelete.setGraphic(ImageManager.instance().getImageView(Images.DELETE)); btDelete.setContentDisplay(ContentDisplay.LEFT); // choose file btFileChooser.setGraphic(ImageManager.instance().getImageView(Images.CHOOSE_FILE)); btFileChooser.setContentDisplay(ContentDisplay.LEFT); }
Example #16
Source File: CronEditorController.java From OEE-Designer with MIT License | 6 votes |
@Override protected void setImages() throws Exception { super.setImages(); // new btNew.setGraphic(ImageManager.instance().getImageView(Images.NEW)); btNew.setContentDisplay(ContentDisplay.LEFT); // save btSave.setGraphic(ImageManager.instance().getImageView(Images.SAVE)); btSave.setContentDisplay(ContentDisplay.LEFT); // delete btDelete.setGraphic(ImageManager.instance().getImageView(Images.DELETE)); btDelete.setContentDisplay(ContentDisplay.LEFT); // help btCronHelp.setGraphic(ImageManager.instance().getImageView(Images.HELP)); btCronHelp.setContentDisplay(ContentDisplay.LEFT); // test btTest.setGraphic(ImageManager.instance().getImageView(Images.EXECUTE)); btTest.setContentDisplay(ContentDisplay.LEFT); }
Example #17
Source File: ModbusTrendController.java From OEE-Designer with MIT License | 6 votes |
@Override protected void setImages() throws Exception { super.setImages(); // connect btConnect.setGraphic(ImageManager.instance().getImageView(Images.CONNECT)); btConnect.setContentDisplay(ContentDisplay.LEFT); // disconnect btDisconnect.setGraphic(ImageManager.instance().getImageView(Images.DISCONNECT)); btDisconnect.setContentDisplay(ContentDisplay.LEFT); // cancel connect btCancelConnect.setGraphic(ImageManager.instance().getImageView(Images.CANCEL)); btCancelConnect.setContentDisplay(ContentDisplay.LEFT); }
Example #18
Source File: DatabaseServerController.java From OEE-Designer with MIT License | 6 votes |
@Override protected void setImages() throws Exception { super.setImages(); // new btNew.setGraphic(ImageManager.instance().getImageView(Images.NEW)); btNew.setContentDisplay(ContentDisplay.LEFT); // save btSave.setGraphic(ImageManager.instance().getImageView(Images.SAVE)); btSave.setContentDisplay(ContentDisplay.LEFT); // delete btDelete.setGraphic(ImageManager.instance().getImageView(Images.DELETE)); btDelete.setContentDisplay(ContentDisplay.LEFT); // test btTest.setGraphic(ImageManager.instance().getImageView(Images.EXECUTE)); btTest.setContentDisplay(ContentDisplay.LEFT); }
Example #19
Source File: EquipmentMaterialController.java From OEE-Designer with MIT License | 6 votes |
protected void setImages() throws Exception { // new equipment material btNewMaterial.setGraphic(ImageManager.instance().getImageView(Images.NEW)); btNewMaterial.setContentDisplay(ContentDisplay.RIGHT); // add equipment material btAddMaterial.setGraphic(ImageManager.instance().getImageView(Images.ADD)); btAddMaterial.setContentDisplay(ContentDisplay.RIGHT); // remove equipment material btRemoveMaterial.setGraphic(ImageManager.instance().getImageView(Images.REMOVE)); btRemoveMaterial.setContentDisplay(ContentDisplay.RIGHT); // find material btFindMaterial.setGraphic(ImageManager.instance().getImageView(Images.MATERIAL)); btFindMaterial.setContentDisplay(ContentDisplay.CENTER); // find UOMs btFindIRRUnit.setGraphic(ImageManager.instance().getImageView(Images.UOM)); btFindIRRUnit.setContentDisplay(ContentDisplay.CENTER); btFindRejectUnit.setGraphic(ImageManager.instance().getImageView(Images.UOM)); btFindRejectUnit.setContentDisplay(ContentDisplay.CENTER); }
Example #20
Source File: TesterController.java From OEE-Designer with MIT License | 6 votes |
private void setImages() throws Exception { // entity btHttpGetEntities.setGraphic(ImageManager.instance().getImageView(Images.EQUIPMENT)); btHttpGetEntities.setContentDisplay(ContentDisplay.LEFT); // materials btHttpGetMaterials.setGraphic(ImageManager.instance().getImageView(Images.MATERIAL)); btHttpGetMaterials.setContentDisplay(ContentDisplay.LEFT); // reasons btHttpGetReasons.setGraphic(ImageManager.instance().getImageView(Images.REASON)); btHttpGetReasons.setContentDisplay(ContentDisplay.LEFT); // execute btTest.setGraphic(ImageManager.instance().getImageView(Images.EXECUTE)); btTest.setContentDisplay(ContentDisplay.LEFT); // reset btReset.setGraphic(ImageManager.instance().getImageView(Images.REFRESH_ALL)); btReset.setContentDisplay(ContentDisplay.LEFT); }
Example #21
Source File: HttpServerController.java From OEE-Designer with MIT License | 6 votes |
@Override protected void setImages() throws Exception { super.setImages(); // new btNew.setGraphic(ImageManager.instance().getImageView(Images.NEW)); btNew.setContentDisplay(ContentDisplay.LEFT); // save btSave.setGraphic(ImageManager.instance().getImageView(Images.SAVE)); btSave.setContentDisplay(ContentDisplay.LEFT); // delete btDelete.setGraphic(ImageManager.instance().getImageView(Images.DELETE)); btDelete.setContentDisplay(ContentDisplay.LEFT); // test btHttpTest.setGraphic(ImageManager.instance().getImageView(Images.EXECUTE)); btHttpTest.setContentDisplay(ContentDisplay.LEFT); }
Example #22
Source File: GenericEditableTableCell.java From JFoenix with Apache License 2.0 | 6 votes |
@Override public void startEdit() { if (isEditable()) { super.startEdit(); // focus cell (in case of validation error the focus will remain) getTableView().getFocusModel().focus(getTableRow().getIndex(), getTableColumn()); if (editorNode == null) { createEditorNode(); } else { // set current value if the editor is already created builder.setValue(getValue()); } builder.startEdit(); setGraphic(editorNode); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } }
Example #23
Source File: GenericEditableTreeTableCell.java From JFoenix with Apache License 2.0 | 5 votes |
@Override public void cancelEdit() { //Once the edit has been cancelled we no longer need the editor //so we mark it for cleanup here. Note though that you have to handle //this situation in the focus listener which gets fired at the end //of the editing. editorNode = null; super.cancelEdit(); builder.cancelEdit(); builder.setValue(getValue()); builder.nullEditorNode(); setContentDisplay(ContentDisplay.TEXT_ONLY); }
Example #24
Source File: ViewSimple.java From helloiot with GNU General Public License v3.0 | 5 votes |
@Override protected Node constructContent() { content = new Label(null); content.setContentDisplay(ContentDisplay.TOP); content.setAlignment(Pos.CENTER); content.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); VBox.setVgrow(content, Priority.SOMETIMES); return content; }
Example #25
Source File: Exercise_16_16.java From Intro-to-Java-Programming with MIT License | 5 votes |
@Override // Override the start method in the Application class public void start(Stage primaryStage) { // Set combo box properties cbo.getItems().addAll("SINGLE", "MULTIPLE"); cbo.setValue("SINGLE"); // Create a label and set its content display Label lblSelectionMode = new Label("Choose Selection Mode:", cbo); lblSelectionMode.setContentDisplay(ContentDisplay.RIGHT); // Set defaut list view as single lv.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); // Create and register the handlers cbo.setOnAction(e -> { setMode(); setText(); }); lv.getSelectionModel().selectedItemProperty().addListener( ov -> { setMode(); setText(); }); // Place nodes in the pane BorderPane pane = new BorderPane(); pane.setTop(lblSelectionMode); pane.setCenter(new ScrollPane(lv)); pane.setBottom(lblSelectedItems); pane.setAlignment(lblSelectionMode, Pos.CENTER); // Create a scene and place it in the stage Scene scene = new Scene(pane, 268, 196); primaryStage.setTitle("Exercise_16_16"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage }
Example #26
Source File: StackPaneSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public StackPaneSample() { StackPane stackPane = new StackPane(); Rectangle rectangle = new Rectangle(280, 70, Color.BISQUE); rectangle.setStroke(Color.BLACK); ImageView imageView = new ImageView(ICON_48); Label label = new Label("Your name could be here.", imageView); label.setContentDisplay(ContentDisplay.RIGHT); stackPane.getChildren().addAll(rectangle, label); getChildren().add(stackPane); }
Example #27
Source File: TVProgramListCell.java From examples-javafx-repos1 with Apache License 2.0 | 5 votes |
public TVProgramListCell() { programNameLabel.getStyleClass().add( "tvtable-program-name" ); lastRecordingLabel.getStyleClass().add( "tvtable-last-recording" ); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); VBox vbox = new VBox(); vbox.getStyleClass().add( "tvtable-cell-container" ); vbox.getChildren().addAll( programNameLabel ); setGraphic( vbox ); vbox.hoverProperty().addListener((obs, ov, onHover) -> { // turn a hover event into a forced focus call if( onHover ) { // this.getListView().getFocusModel().focus( this.getIndex() ); this.getListView().getSelectionModel().select( this.getIndex() ); } }); // this.focusedProperty().addListener((obs,ov,nv) -> { this.selectedProperty().addListener((obs,ov,nv) -> { if( nv ) { if( !vbox.getChildren().contains(lastRecordingLabel) ) { vbox.getChildren().add( lastRecordingLabel ); } } else { if( vbox.getChildren().contains(lastRecordingLabel) ) { vbox.getChildren().remove(lastRecordingLabel); } } }); }
Example #28
Source File: GraphicButton.java From marathonv5 with Apache License 2.0 | 5 votes |
public GraphicButton() { super(400,100); ImageView imageView = new ImageView(ICON_48); Button button = new Button("button", imageView); button.setContentDisplay(ContentDisplay.LEFT); getChildren().add(button); }
Example #29
Source File: BaseQuickbarButton.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void invalidated() { if (get()) { setContentDisplay(ContentDisplay.LEFT); setAlignment(Pos.CENTER_LEFT); } else { setContentDisplay(ContentDisplay.GRAPHIC_ONLY); setAlignment(Pos.CENTER); } }
Example #30
Source File: MaterialMenuItem.java From MSPaintIDE with MIT License | 5 votes |
public MaterialMenuItem() { label = new Label(); label.setPrefWidth(180); label.setPadding(new Insets(0, 0, 0, 5)); label.setContentDisplay(ContentDisplay.RIGHT); label.setGraphicTextGap(0); setGraphic(label); }