当前位置: 首页>>代码示例>>Java>>正文


Java Button.setDisable方法代码示例

本文整理汇总了Java中javafx.scene.control.Button.setDisable方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setDisable方法的具体用法?Java Button.setDisable怎么用?Java Button.setDisable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Button的用法示例。


在下文中一共展示了Button.setDisable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPlayButtonEnabled

import javafx.scene.control.Button; //导入方法依赖的package包/类
private void setPlayButtonEnabled(boolean bool){
	Button b = null;
	if (caller instanceof GodTabController){
		b = ((GodTabController) caller).getPlayButton();
	} else if (caller instanceof NpcTabController){
		b = ((NpcTabController) caller).getPlayButton();
	} else if (caller instanceof RegionTabController){
		b = ((RegionTabController) caller).getPlayButton();
	} else if (caller instanceof EventTabController){
		b = ((EventTabController) caller).getPlayButton();
	}
	if (bool) {
		b.setDisable(false);
	} else {
		b.setDisable(true);
	}
	
}
 
开发者ID:ForJ-Latech,项目名称:fwm,代码行数:19,代码来源:AddableSound.java

示例2: setEnabled

import javafx.scene.control.Button; //导入方法依赖的package包/类
public void setEnabled(boolean b) {
    for (Button button : buttons) {
        button.setDisable(!b);
    }
    for (MenuItem menuItem : menuItems) {
        menuItem.setDisable(!b);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:AbstractSimpleAction.java

示例3: validateFileName

import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
@FXThread
protected void validateFileName() {
    super.validateFileName();

    final GridPane settingsContainer = getSettingsContainer();
    settingsContainer.getChildren().stream()
            .filter(PropertyEditorControl.class::isInstance)
            .map(PropertyEditorControl.class::cast)
            .forEach(PropertyEditorControl::checkDependency);

    final Button okButton = getOkButton();
    if (okButton == null) return;

    final boolean result = validate(getVars());

    if (!okButton.isDisabled()) {
        okButton.setDisable(!result);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:21,代码来源:GenericFileCreator.java

示例4: validateFileName

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Validate the inputted name.
 */
@FXThread
protected void validateFileName() {

    final Button okButton = getOkButton();
    if (okButton == null) return;

    final Path fileToCreate = getFileToSave();

    if (fileToCreate == null) {
        okButton.setDisable(true);
        return;
    }

    okButton.setDisable(false);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:19,代码来源:SaveAsEditorDialog.java

示例5: createToolbar

import javafx.scene.control.Button; //导入方法依赖的package包/类
public VLToolBar createToolbar(ResourceView resourceView) {
    VLToolBar toolbar = new VLToolBar();
    Button expandAll = FXUIUtils.createButton("expandAll", "Expand the resource tree");
    expandAll.setOnAction((event) -> resourceView.expandAll());
    toolbar.add(expandAll);
    Button collapseAll = FXUIUtils.createButton("collapseAll", "Collapse the resource tree");
    collapseAll.setOnAction((event) -> resourceView.collapseAll());
    toolbar.add(collapseAll);
    toolbar.add(new Separator(javafx.geometry.Orientation.VERTICAL));
    Button cut = FXUIUtils.createButton("cut", "Cut the selected content to clipboard");
    cut.setOnAction((event) -> resourceView.cut());
    toolbar.add(cut);
    Button copy = FXUIUtils.createButton("copy", "Copy the selected content to clipboard");
    copy.setOnAction((event) -> resourceView.copy());
    toolbar.add(copy);
    Button paste = FXUIUtils.createButton("paste", "Paste clipboard contents");
    paste.setOnAction((event) -> resourceView.paste());
    toolbar.add(paste);
    ListChangeListener<? super TreeItem<Resource>> listener = new ListChangeListener<TreeItem<Resource>>() {
        @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends TreeItem<Resource>> c) {
            cut.setDisable(resourceView.getSelectionModel().getSelectedItems().size() <= 0);
            copy.setDisable(resourceView.getSelectionModel().getSelectedItems().size() <= 0);
            paste.setDisable(resourceView.getSelectionModel().getSelectedItems().size() != 1);
        }
    };
    resourceView.getSelectionModel().getSelectedItems().addListener(listener);
    return toolbar;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:29,代码来源:NavigatorPanel.java

示例6: formatButtons

import javafx.scene.control.Button; //导入方法依赖的package包/类
private void formatButtons() {
    int min = pokemon.getMinIndividualValues().get(stat).get();
    int max = pokemon.getMaxIndividualValues().get(stat).get();
    for (int i = 0; i < 32; ++i) {
        Button button = statButtons.get(i);
        button.setDisable(i < min || i > max);
        button.setText(String.valueOf(pokemon.getExpectedStat(stat, i)));
    }
}
 
开发者ID:wartab,项目名称:gen7-iv-calculator,代码行数:10,代码来源:StatSelectorPresenter.java

示例7: processSelect

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Handle a selected object.
 */
@FXThread
private void processSelect(@Nullable final Object object) {
    final Object result = object instanceof TreeNode ? ((TreeNode) object).getElement() : object;
    final Class<T> type = getType();
    final Button okButton = getOkButton();
    okButton.setDisable(!type.isInstance(result));
    selected = type.isInstance(result) ? type.cast(result) : null;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:12,代码来源:NodeSelectorDialog.java

示例8: NodeSelectorDialog

import javafx.scene.control.Button; //导入方法依赖的package包/类
public NodeSelectorDialog(@NotNull final Spatial model, @NotNull final Class<T> type,
                          @NotNull final Consumer<T> handler) {
    this.model = model;
    this.type = type;
    this.handler = handler;

    final ModelNodeTree nodeTree = getNodeTree();
    nodeTree.fill(getModel());

    final Button okButton = getOkButton();
    okButton.setDisable(true);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:13,代码来源:NodeSelectorDialog.java

示例9: validateName

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Validate a new name.
 */
@FXThread
private void validateName(@NotNull final String name) {
    final Function<String, Boolean> validator = getValidator();
    final Button okButton = getOkButton();
    okButton.setDisable(!(validator == null || validator.apply(name)));
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:10,代码来源:RenameDialog.java

示例10: processSelected

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Handle selected element in the tree.
 */
@FXThread
private void processSelected(@Nullable final TreeItem<ResourceElement> newValue) {
    final ResourceElement element = newValue == null ? null : newValue.getValue();
    final Path file = element == null ? null : element.getFile();
    final Button okButton = notNull(getOkButton());
    okButton.setDisable(file == null || !Files.isWritable(file));
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:11,代码来源:ExternalFileEditorDialog.java

示例11: createControls

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Create controls.
 */
private void createControls() {

    final Label propertyNameLabel = new Label(getControlTitle() + ":");

    elementContainer = new VBox();

    final Button addButton = new Button();
    addButton.setGraphic(new ImageView(Icons.ADD_16));
    addButton.setOnAction(event -> processAdd());

    final Button removeButton = new Button();
    removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
    removeButton.setOnAction(event -> processRemove());
    removeButton.setDisable(true);

    final HBox buttonContainer = new HBox(addButton, removeButton);

    final ObservableList<Node> children = elementContainer.getChildren();
    children.addListener((ListChangeListener<Node>) c -> removeButton.setDisable(children.size() < (getMinElements() + 1)));

    FXUtils.addToPane(propertyNameLabel, this);
    FXUtils.addToPane(elementContainer, this);
    FXUtils.addToPane(buttonContainer, this);

    FXUtils.addClassTo(propertyNameLabel, CSSClasses.ABSTRACT_PARAM_CONTROL_PARAM_NAME_SINGLE_ROW);
    FXUtils.addClassTo(addButton, CSSClasses.BUTTON_WITHOUT_RIGHT_BORDER);
    FXUtils.addClassTo(removeButton, CSSClasses.BUTTON_WITHOUT_LEFT_BORDER);
    FXUtils.addClassTo(buttonContainer, CSSClasses.DEF_HBOX);
    FXUtils.addClassTo(elementContainer, CSSClasses.DEF_VBOX);

    DynamicIconSupport.addSupport(addButton, removeButton);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:36,代码来源:PhysicsNodeListControl.java

示例12: validate

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Validate.
 */
@FXThread
private void validate() {

    final FloatTextField hillMaxRadiusField = getHillMaxRadiusField();
    final FloatTextField hillMinRadiusField = getHillMinRadiusField();

    final ChooseFolderControl alphaTextureFolderControl = getAlphaTextureFolderControl();
    final ChooseTextureControl baseTextureControl = getBaseTextureControl();
    final ChooseTextureControl heightMapImageControl = getHeightMapImageControl();

    final ComboBox<HeightMapType> heightMapTypeComboBox = getHeightMapTypeComboBox();
    final HeightMapType heightMapType = heightMapTypeComboBox.getSelectionModel().getSelectedItem();

    final Button okButton = getOkButton();
    okButton.setDisable(true);

    final Path baseTexture = baseTextureControl.getTextureFile();
    final Path folder = alphaTextureFolderControl.getFolder();
    if (baseTexture == null || folder == null) return;

    if (heightMapType == HeightMapType.IMAGE_BASED) {
        final Path heightTexture = heightMapImageControl.getTextureFile();
        if (heightTexture == null) return;
    } else if (heightMapType == HeightMapType.HILL) {
        final float minValue = hillMinRadiusField.getValue();
        final float maxValue = hillMaxRadiusField.getValue();
        if (maxValue < minValue) return;
    }

    okButton.setDisable(false);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:35,代码来源:CreateTerrainDialog.java

示例13: MemberPane

import javafx.scene.control.Button; //导入方法依赖的package包/类
public MemberPane(Organization organization, EditOrganizationStage oms) {
	super();
	this.organization = organization;
	this.eos = oms;
	
	members = FXCollections.observableArrayList();
	forceUpdateMemberList();

	memberTable = new TableView<>(members);

	TableColumn<MemberView, String> nameCol = new TableColumn<>("Name");

	nameCol.setCellValueFactory(new PropertyValueFactory<>("username"));
	ColumnConstraints cc = new ColumnConstraints();
	cc.setPercentWidth(100);
	
	memberTable.getColumns().add(nameCol);
	
	memberTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
	
	buttonPane = new GridPane();
	buttonPane.setPadding(new Insets(10, 0, 0, 0));
	buttonPane.setHgap(5);

	addMember = new Button("Add Member...");
	removeMember = new Button("Remove selected");
	transfertOwnership = new Button("Transfert Ownership");

	buttonPane.addRow(0, addMember, removeMember, transfertOwnership);

	addMember.setOnAction(this::addMemberAction);
	removeMember.setOnAction(this::removeMemberAction);
	transfertOwnership.setOnAction(this::transferOwnershipAction);

	removeMember.setDisable(true);
	transfertOwnership.setDisable(true);
	
	Label title = new Label("Members :");
	title.setPadding(new Insets(0, 0, 10, 0));
	
	setTop(title);
	setCenter(memberTable);
	setBottom(buttonPane);

	memberTable.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
		if (newSelection == null || newSelection.isYou()) {
			removeMember.setDisable(true);
			transfertOwnership.setDisable(true);
		} else {
			removeMember.setDisable(false);
			transfertOwnership.setDisable(false);
		}
	});
	
}
 
开发者ID:ScreachFr,项目名称:titanium,代码行数:56,代码来源:MemberPane.java

示例14: ServerPane

import javafx.scene.control.Button; //导入方法依赖的package包/类
public ServerPane(Organization organization, OrganizationManagerStage oms) {
	super();
	this.organization = organization;
	this.oms = oms;
	
	servers = FXCollections.observableArrayList();

	forceUpdateServerList();
	
	serverTable = new TableView<>(servers);
	serverTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
	
	TableColumn<ServerView, String> nameCol = new TableColumn<>("Name");
	TableColumn<ServerView, String> addressCol = new TableColumn<>("Address");

	nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));
	addressCol.setCellValueFactory(new PropertyValueFactory<>("address"));

	serverTable.getColumns().add(nameCol);
	serverTable.getColumns().add(addressCol);
	
	buttonPane = new GridPane();
	buttonPane.setPadding(new Insets(10, 0, 0, 0));
	buttonPane.setHgap(5);
	
	addButton = new Button("Add Server...");
	editButton = new Button("Edit selected...");
	removeButton = new Button("Remove selected");
	
	addButton.setOnAction(this::addServerAction);
	editButton.setOnAction(this::editServerAction);
	removeButton.setOnAction(this::removeServerAction);
	
	editButton.setDisable(true);
	removeButton.setDisable(true);
	
	buttonPane.addRow(0, addButton, editButton, removeButton);
	
	Label title = new Label("Servers :");
	title.setPadding(new Insets(0, 0, 10, 0));
	
	setTop(title);
	setCenter(serverTable);
	setBottom(buttonPane);
	
	serverTable.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
		if (newSelection == null) {
			editButton.setDisable(true);
			removeButton.setDisable(true);
		} else {
			editButton.setDisable(false);
			removeButton.setDisable(false);
		}
	});
	
}
 
开发者ID:ScreachFr,项目名称:titanium,代码行数:57,代码来源:ServerPane.java

示例15: validate

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Validate the dialog.
 */
@FXThread
private void validate() {
    if (!isReady()) return;

    final ComboBox<SkyType> skyTypeComboBox = getSkyTypeComboBox();
    final SingleSelectionModel<SkyType> selectionModel = skyTypeComboBox.getSelectionModel();
    final SkyType selectedItem = selectionModel.getSelectedItem();

    final Button okButton = getOkButton();
    okButton.setDisable(true);

    if (isEditableSky()) {

        final ChooseFolderControl materialFolderControl = getMaterialFolderControl();
        final TextField materialNameField = getMaterialNameField();

        final boolean valid = materialFolderControl.getFolder() != null &&
                !StringUtils.isEmpty(materialNameField.getText());

        if (!valid) {
            okButton.setDisable(true);
            return;
        }
    }

    if (selectedItem == SkyType.SINGLE_TEXTURE) {

        final ComboBox<EnvMapType> envMapTypeComboBox = getEnvMapTypeComboBox();
        final EnvMapType envMapType = envMapTypeComboBox.getSelectionModel().getSelectedItem();

        final ChooseTextureControl singleTextureControl = getSingleTextureControl();
        final Path textureFile = singleTextureControl.getTextureFile();

        okButton.setDisable(envMapType == null || textureFile == null);

    } else if (selectedItem == SkyType.MULTIPLE_TEXTURE) {

        final ChooseTextureControl northTextureControl = getNorthTextureControl();
        final Path northTextureFile = northTextureControl.getTextureFile();

        final ChooseTextureControl southTextureControl = getSouthTextureControl();
        final Path southTextureFile = southTextureControl.getTextureFile();

        final ChooseTextureControl eastTextureControl = getEastTextureControl();
        final Path eastTextureFile = eastTextureControl.getTextureFile();

        final ChooseTextureControl westTextureControl = getWestTextureControl();
        final Path westTextureFile = westTextureControl.getTextureFile();

        final ChooseTextureControl topTextureControl = getTopTextureControl();
        final Path topTextureFile = topTextureControl.getTextureFile();

        final ChooseTextureControl bottomTextureControl = getBottomTextureControl();
        final Path bottomTextureFile = bottomTextureControl.getTextureFile();

        if (northTextureFile == null || southTextureFile == null) {
            okButton.setDisable(true);
        } else if (eastTextureFile == null || westTextureFile == null) {
            okButton.setDisable(true);
        } else if (topTextureFile == null || bottomTextureFile == null) {
            okButton.setDisable(true);
        } else {
            okButton.setDisable(false);
        }
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:70,代码来源:CreateSkyDialog.java


注:本文中的javafx.scene.control.Button.setDisable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。