當前位置: 首頁>>代碼示例>>Java>>正文


Java BooleanProperty.addListener方法代碼示例

本文整理匯總了Java中javafx.beans.property.BooleanProperty.addListener方法的典型用法代碼示例。如果您正苦於以下問題:Java BooleanProperty.addListener方法的具體用法?Java BooleanProperty.addListener怎麽用?Java BooleanProperty.addListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.beans.property.BooleanProperty的用法示例。


在下文中一共展示了BooleanProperty.addListener方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setActions

import javafx.beans.property.BooleanProperty; //導入方法依賴的package包/類
/**
 * Overrides the draggable's set action method to lisen for when
 * you can drag a sprite or not
 *
 * @param source
 */
@Override
public void setActions (Node source) {
    BooleanProperty canPlace = getProfilable().getCost().canPlace();
    setDraggedOrNot(source, canPlace.get());
    canPlace.addListener( (observable, oldValue, newValue) -> setDraggedOrNot(source,
                                                                              newValue));
}
 
開發者ID:tomrom95,項目名稱:GameAuthoringEnvironment,代碼行數:14,代碼來源:PlayerSideBarCell.java

示例2: bind

import javafx.beans.property.BooleanProperty; //導入方法依賴的package包/類
public void bind(final BooleanProperty property, final String propertyName) {
    String value = props.getProperty(propertyName);
    if (value != null) {
        property.set(Boolean.valueOf(value));
    }
    property.addListener(new InvalidationListener() {

        @Override
        public void invalidated(Observable o) {
            props.setProperty(propertyName, property.getValue().toString());
        }
    });
}
 
開發者ID:comtel2000,項目名稱:mokka7,代碼行數:14,代碼來源:SessionManager.java

示例3: setShowOnlineDatabase

import javafx.beans.property.BooleanProperty; //導入方法依賴的package包/類
@Override
public void setShowOnlineDatabase(BooleanProperty showOnlineDatabase) {
    showOnlineDatabase.addListener((observable, oldValue, newValue) -> {
        if (newValue == null) {
            return;
        }

        manager.toggleDatabase(newValue);
    });
}
 
開發者ID:stechy1,項目名稱:drd,代碼行數:11,代碼來源:ShopGeneralController.java

示例4: setupValuePane

import javafx.beans.property.BooleanProperty; //導入方法依賴的package包/類
private Pane setupValuePane(Dimension<?> dimension, Label titleLabel, Pane contentPane) {
	final HBox titlePane = new HBox();
	final VBox valueVBox = new VBox();
	final Node backValueGraphicNode = new ImageView(backValueGraphic);
	final double buttonScale = 0.66;
	backValueGraphicNode.setScaleX(1 / buttonScale);
	backValueGraphicNode.setScaleY(1 / buttonScale);
	final Button backValue = new Button("", backValueGraphicNode);
	backValue.setOnAction((e) -> {
		traceExplorer.backValue(dimension);
	});
	backValue.setScaleX(buttonScale);
	backValue.setScaleY(buttonScale);
	backValue.setDisable(!traceExplorer.canBackValue(dimension));
	final Node stepValueGraphicNode = new ImageView(stepValueGraphic);
	stepValueGraphicNode.setScaleX(1 / buttonScale);
	stepValueGraphicNode.setScaleY(1 / buttonScale);
	final Button stepValue = new Button("", stepValueGraphicNode);
	stepValue.setOnAction((e) -> {
		traceExplorer.stepValue(dimension);
	});
	stepValue.setDisable(!traceExplorer.canStepValue(dimension));
	stepValue.setScaleX(buttonScale);
	stepValue.setScaleY(buttonScale);
	titlePane.setAlignment(Pos.CENTER_LEFT);
	VBox.setMargin(titlePane, HALF_MARGIN_INSETS);
	VBox.setMargin(contentPane, MARGIN_INSETS);

	final CheckBox showValueCheckBox = new CheckBox();
	showValueCheckBox.setScaleX(buttonScale);
	showValueCheckBox.setScaleY(buttonScale);
	boolean hide = traceExtractor.isDimensionIgnored(dimension);
	if (hide) {
		showValueCheckBox.setSelected(false);
	} else {
		showValueCheckBox.setSelected(true);
	}
	BooleanProperty sel = showValueCheckBox.selectedProperty();
	backValue.visibleProperty().bind(sel);
	stepValue.visibleProperty().bind(sel);
	sel.addListener((v, o, n) -> {
		if (o != n) {
			traceExtractor.ignoreDimension(dimension, !n);
			if (n) {
				valueVBox.getChildren().add(contentPane);
			} else {
				valueVBox.getChildren().remove(contentPane);
			}
			sortValueLines();
		}
	});
	titlePane.getChildren().addAll(showValueCheckBox, titleLabel, backValue, stepValue);
	valueVBox.getChildren().add(titlePane);
	if (!hide) {
		valueVBox.getChildren().add(contentPane);
	}

	valuesLines.getChildren().add(valueVBox);
	valueVBox.setUserData(dimension);
	titleLabel.minWidthProperty().bind(valueTitleWidth);
	titleLabel.widthProperty().addListener((v, o, n) -> {
		if (n.doubleValue() > valueTitleWidth.get()) {
			valueTitleWidth.set(n.doubleValue());
		}
	});
	if (titleLabel.widthProperty().doubleValue() > valueTitleWidth.get()) {
		valueTitleWidth.set(titleLabel.widthProperty().doubleValue());
	}

	return valueVBox;
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:72,代碼來源:MultidimensionalTimelineRenderer.java

示例5: initPropertyComponents

import javafx.beans.property.BooleanProperty; //導入方法依賴的package包/類
private void initPropertyComponents() {
	// General Properties
	sampPathTextField.setText(ClientPropertiesController.getPropertyAsString(Property.SAMP_PATH));
	sampPathTextField.textProperty().addListener((__, ___, newValue) -> {
		ClientPropertiesController.setProperty(Property.SAMP_PATH, newValue.trim());
	});

	setupCheckBox(saveLastViewCheckBox, Property.SAVE_LAST_VIEW);

	languageComboBox.getItems().addAll(Language.values());
	final Language toSelectLanguage = Language.getByShortcut(ClientPropertiesController.getPropertyAsString(Property.LANGUAGE)).get();
	languageComboBox.getSelectionModel().select(toSelectLanguage);
	languageComboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldVal, newVal) -> {
		final Locale locale = new Locale(newVal.getShortcut());
		Client.lang = ResourceBundle.getBundle("com.msc.serverbrowser.localization.Lang", locale);
		ClientPropertiesController.setProperty(Property.LANGUAGE, newVal.getShortcut());
		Client.getInstance().reloadViewIfLoaded(View.SETTINGS);
	});

	// Connection Properties
	// setupCheckBox(askForUsernameOnConnectCheckBox,
	// Property.ASK_FOR_NAME_ON_CONNECT);

	// Appearance Properties
	setupCheckBox(darkThemeCheckBox, Property.USE_DARK_THEME);
	darkThemeCheckBox.selectedProperty().addListener((__, ___, newValue) -> {
		final Boolean saveLastViewOld = ClientPropertiesController.getPropertyAsBoolean(Property.SAVE_LAST_VIEW);
		ClientPropertiesController.setProperty(Property.SAVE_LAST_VIEW, true);
		ClientPropertiesController.setProperty(Property.LAST_VIEW, View.SETTINGS.getId());

		Client.getInstance().applyTheme();

		ClientPropertiesController.setProperty(Property.SAVE_LAST_VIEW, saveLastViewOld);
	});

	// Permission Properties
	setupCheckBox(allowCloseSampCheckBox, Property.ALLOW_CLOSE_SAMP);
	setupCheckBox(allowCloseGtaCheckBox, Property.ALLOW_CLOSE_GTA);

	// Update Properties
	setupCheckBox(showChangelogCheckBox, Property.CHANGELOG_ENABLED);
	setupCheckBox(enableAutomaticUpdatesCheckBox, Property.AUTOMTAIC_UPDATES);

	// Update Properties
	setupCheckBox(allowCachingDownloadsCheckBox, Property.ALLOW_CACHING_DOWNLOADS);

	// Adding a listener to disable the update button incase an update is ongoing
	final BooleanProperty updatingProperty = Client.getInstance().updatingProperty;
	updatingProperty.addListener((observable, oldVal, newVal) -> {
		manualUpdateButton.setDisable(newVal);
	});
	manualUpdateButton.setDisable(updatingProperty.get());
}
 
開發者ID:Bios-Marcel,項目名稱:ServerBrowser,代碼行數:54,代碼來源:SettingsController.java


注:本文中的javafx.beans.property.BooleanProperty.addListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。