@Override protected ReadOnlyBooleanWrapper createChangeableProperty(boolean changeable) { ReadOnlyBooleanWrapper changeableProperty = new ReadOnlyBooleanWrapper(changeable); // if the disabled property changes, change the controlChangeable property as well changeableProperty.bind(getNode().disabledProperty().not()); return changeableProperty; }
@Override public void initialize() { LOG.debug("New tweet stage ready."); enableTweetLengthCheck(); Buttons.setOnClick(sendButton, this::send); Buttons.setOnClick(pickMediaButton, this::openMediaAttachmentsFilePicker); final BooleanBinding mediasNotEmpty = mediasToUpload.emptyProperty().not(); mediaPreviewBox.visibleProperty().bind(mediasNotEmpty); mediaPreviewBox.managedProperty().bind(mediasNotEmpty); inReplyStatus.addListener((o, prev, cur) -> prefillMentionsForReply()); sendOnControlEnter(); }
private VBox createMenuBodyMainMenu() { Button btnContinue = createActionButton("CONTINUE", this::fireContinue); Button btnNew = createActionButton("NEW GAME", this::fireNewGame); Button btnLoad = createContentButton("LOAD GAME", this::createContentLoad); Button btnLogout = createActionButton("LOGOUT", this::fireLogout); Button btnExit = createActionButton("EXIT", this::fireExit); btnContinue.disableProperty().bind(listener.hasSavesProperty().not()); return new VBox(10, btnContinue, btnNew, btnLoad, btnLogout, btnExit); }
/** * Configures a {@link MenuItem} with the specified action. * * @param menuItem the menu item to configre * @param action the action * @param iconSize the icon size */ public static void configureMenuItem(MenuItem menuItem, FXAction action, int iconSize) { menuItem.setMnemonicParsing(true); menuItem.textProperty().bind(action.displayNameProperty()); menuItem.acceleratorProperty().bind(action.acceleratorProperty()); menuItem.setOnAction(action); menuItem.disableProperty().bind(action.enabledProperty().not()); if (action.getGraphicFactory() != null) { Node graphic = action.getGraphicFactory().createGraphic(iconSize); if (graphic != null) { menuItem.setGraphic(graphic); } } }
box.add(itemContinue); itemContinue.disableProperty().bind(listener.hasSavesProperty().not());
button.disableProperty().bind(action.enabledProperty().not()); final String displayName = MnemonicUtils.removeMnemonicChar(action.getDisplayName()); if (action.getGraphicFactory() != null) {
btnContinue.disableProperty().bind(listener.hasSavesProperty().not());
.and(disabledProperty().not()) );