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


Java Button.setGraphic方法代码示例

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


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

示例1: createGameFileChooserButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button createGameFileChooserButton() {
		Button button = new Button();
		Image image = new Image(NEW_GAME);
		ImageView imageView = new ImageView(image);
		imageView.setFitWidth(App.WIDTH / 3);
		imageView.setPreserveRatio(true);
		button.setGraphic(imageView);
		//button.setWrapText(true);
		button.setOnMouseClicked((e) -> {
			FileLoader fileLoader = new FileLoader(primaryStage);
			File fileChosen = fileLoader.chooseFile();
			if (fileChosen != null) {
				startGame(fileChosen);
			}
		});
//		getRotation(button);
		return button;
	}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:19,代码来源:GameChooser.java

示例2: createRemovableSearchOutput

import javafx.scene.control.Button; //导入方法依赖的package包/类
private SearchOutput createRemovableSearchOutput() {
    SearchOutput output = new SearchOutput();
    output.setId("second-output");

    Button removeButton = new Button();
    removeButton.setGraphic(new TangoIconWrapper("actions:list-remove"));
    removeButton.setTooltip(new Tooltip("unsplit output"));
    removeButton.setId("unsplit-output-button");

    removeButton.setOnAction(event -> {
        Node removedOutput = centerBox.getChildren().remove(centerBox.getChildren().size()-1);
        outputs.remove(removedOutput);
        queryGrid.removeAllListenersButFirst();
        outputs.get(0).enableTitleGraphics();
    });
    output.addTitleGraphics(removeButton);

    return output;
}
 
开发者ID:AntonioGabrielAndrade,项目名称:LIRE-Lab,代码行数:20,代码来源:SearchController.java

示例3: createSaveAction

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Create the save action.
 *
 * @return the button
 */
protected @NotNull Button createSaveAction() {

    final Button action = new Button();
    action.setTooltip(new Tooltip(Messages.FILE_EDITOR_ACTION_SAVE + " (Ctrl + S)"));
    action.setOnAction(event -> save());
    action.setGraphic(new ImageView(Icons.SAVE_16));
    action.disableProperty().bind(dirtyProperty().not());

    FXUtils.addClassesTo(action, CSSClasses.FLAT_BUTTON,
            CSSClasses.FILE_EDITOR_TOOLBAR_BUTTON);

    DynamicIconSupport.addSupport(action);

    return action;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:21,代码来源:AbstractFileEditor.java

示例4: createComponents

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

    folderLabel = new Label(StringUtils.EMPTY);
    folderLabel.prefWidthProperty().bind(widthProperty());

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

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

    FXUtils.addToPane(folderLabel, this);
    FXUtils.addToPane(addButton, this);
    FXUtils.addToPane(removeButton, this);

    FXUtils.addClassesTo(this, CSSClasses.TEXT_INPUT_CONTAINER, CSSClasses.CHOOSE_RESOURCE_CONTROL);
    FXUtils.addClassesTo(addButton, removeButton, CSSClasses.FLAT_BUTTON, CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);

    DynamicIconSupport.addSupport(addButton, removeButton);

    removeButton.disableProperty()
            .bind(folderLabel.textProperty().isEmpty());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:29,代码来源:ChooseFolderControl.java

示例5: 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

示例6: createImageButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
public Button createImageButton (Node imgview,
                                 EventHandler<ActionEvent> action) {
    Button newButton = new Button();
    newButton.setGraphic(imgview);
    newButton.setOnAction(action);
    return newButton;
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:8,代码来源:BasicUIFactory.java

示例7: createButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
private void createButton() {
    editButton = new Button();
    editButton.setText("Edit");
    editButton.setPrefWidth(100);
    editButton.setOnAction(this);
    editButton.setGraphic(Glyph.create("FontAwesome|pencil"));
}
 
开发者ID:rumangerst,项目名称:CSLMusicModStationCreator,代码行数:8,代码来源:EditCell.java

示例8: createControls

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Create controls.
 */
protected 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());

    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(elementContainer, CSSClasses.DEF_VBOX);
    FXUtils.addClassTo(addButton, CSSClasses.BUTTON_WITHOUT_RIGHT_BORDER);
    FXUtils.addClassTo(removeButton, CSSClasses.BUTTON_WITHOUT_LEFT_BORDER);
    FXUtils.addClassTo(buttonContainer, CSSClasses.DEF_HBOX);

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

示例9: createComponents

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

    elementLabel = new Label(NO_ELEMENT);
    elementLabel.prefWidthProperty().bind(container.widthProperty());

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

    final Button editButton = new Button();
    editButton.setGraphic(new ImageView(Icons.REMOVE_12));
    editButton.disableProperty().bind(elementLabel.textProperty().isEqualTo(NO_ELEMENT));
    editButton.setOnAction(event -> processRemove());

    FXUtils.addToPane(elementLabel, container);
    FXUtils.addToPane(changeButton, container);
    FXUtils.addToPane(editButton, container);

    FXUtils.addClassesTo(container, CSSClasses.TEXT_INPUT_CONTAINER,
            CSSClasses.ABSTRACT_PARAM_CONTROL_INPUT_CONTAINER);
    FXUtils.addClassTo(elementLabel, CSSClasses.ABSTRACT_PARAM_CONTROL_ELEMENT_LABEL);
    FXUtils.addClassesTo(changeButton, editButton, CSSClasses.FLAT_BUTTON,
            CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);

    DynamicIconSupport.addSupport(changeButton, editButton);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:30,代码来源:ElementPropertyControl.java

示例10: createButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
public Button createButton(Command<E> command, CommandArgProvider<E> provider) {
    Button button = new Button();

    button.setGraphic(command.getIcon());
    button.setTooltip(new Tooltip(command.getLabel()));
    button.setOnAction(event -> command.execute(provider.provide()));

    return button;
}
 
开发者ID:AntonioGabrielAndrade,项目名称:LIRE-Lab,代码行数:10,代码来源:CommandTriggerFactory.java

示例11: showSvgs

import javafx.scene.control.Button; //导入方法依赖的package包/类
private void showSvgs(int index) {
    int x = 0, y = 0;
    for (String j :
            svgData.get(index).getValue().getData().values()) {
        SVGPath path = new SVGPath();
        path.setContent(j);
        Bounds bounds = path.boundsInLocalProperty().getValue();
        double scale = Math.max(bounds.getHeight(),bounds.getWidth());
        path.setScaleX(30 / scale);
        path.setScaleY(30 / scale);
        Button button = new Button();
        button.setGraphic(path);
        button.getStylesheets().add("css/svgbutton_style.css");
        button.setOnMouseClicked(event -> {
            SVGPath svgPath = (SVGPath) button.getGraphic();
            controller.drawSvg(svgPath.getContent());
            (button.getScene().getWindow()).hide();
        });
        button.setManaged(false);
        button.resizeRelocate(x , y, 50, 50);
        x+=55;
        if (x > 399) {
            x = 0;
            y += 55;
        }
        iconsPane.getChildren().add(button);
    }
}
 
开发者ID:xfangfang,项目名称:PhotoScript,代码行数:29,代码来源:GraphicBoard.java

示例12: createComponents

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Create components of this component.
 */
private void createComponents() {

    listView = new ListView<>();
    listView.setCellFactory(param -> new FilterListCell(this));
    listView.setEditable(false);
    listView.setFocusTraversable(true);
    listView.prefHeightProperty().bind(heightProperty());
    listView.prefWidthProperty().bind(widthProperty());
    listView.setFixedCellSize(FXConstants.LIST_CELL_HEIGHT);

    final MultipleSelectionModel<EditableSceneFilter> selectionModel = listView.getSelectionModel();
    selectionModel.selectedItemProperty().addListener((observable, oldValue, newValue) ->
            selectHandler.accept(newValue));

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

    final Button removeButton = new Button();
    removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
    removeButton.setOnAction(event -> removeFilter());
    removeButton.disableProperty().bind(selectionModel.selectedItemProperty().isNull());

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

    FXUtils.addToPane(listView, this);
    FXUtils.addToPane(buttonContainer, this);

    FXUtils.addClassTo(buttonContainer, CSSClasses.DEF_HBOX);
    FXUtils.addClassTo(addButton, CSSClasses.BUTTON_WITHOUT_RIGHT_BORDER);
    FXUtils.addClassTo(removeButton, CSSClasses.BUTTON_WITHOUT_LEFT_BORDER);
    FXUtils.addClassTo(listView, CSSClasses.TRANSPARENT_LIST_VIEW);

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

示例13: createClassesFolderControl

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Create the classes folder control.
 */
@FXThread
private void createClassesFolderControl(@NotNull final VBox root) {

    final HBox container = new HBox();
    container.setAlignment(Pos.CENTER_LEFT);

    final Label label = new Label(Messages.SETTINGS_DIALOG_USER_CLASSES_FOLDER_LABEL + ":");
    final HBox fieldContainer = new HBox();

    classesFolderField = new TextField();
    classesFolderField.setEditable(false);
    classesFolderField.prefWidthProperty().bind(root.widthProperty());

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

    final Button removeButton = new Button();
    removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
    removeButton.setOnAction(event -> processRemoveClassesFolder());
    removeButton.disableProperty().bind(classesFolderField.textProperty().isEmpty());

    FXUtils.addToPane(label, fieldContainer, container);
    FXUtils.addToPane(classesFolderField, addButton, removeButton, fieldContainer);
    FXUtils.addToPane(container, root);

    FXUtils.addClassTo(classesFolderField, CSSClasses.TRANSPARENT_TEXT_FIELD);
    FXUtils.addClassTo(fieldContainer, CSSClasses.TEXT_INPUT_CONTAINER);
    FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
    FXUtils.addClassTo(classesFolderField, fieldContainer, CSSClasses.SETTINGS_DIALOG_FIELD);
    FXUtils.addClassesTo(addButton, removeButton, CSSClasses.FLAT_BUTTON,
            CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);

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

示例14: createComponents

import javafx.scene.control.Button; //导入方法依赖的package包/类
/**
 * Create components of this component.
 */
private void createComponents() {

    listView = new ListView<>();
    listView.setCellFactory(param -> new AppStateListCell(this));
    listView.setEditable(false);
    listView.setFocusTraversable(true);
    listView.prefHeightProperty().bind(heightProperty());
    listView.prefWidthProperty().bind(widthProperty());
    listView.setFixedCellSize(FXConstants.LIST_CELL_HEIGHT);

    final MultipleSelectionModel<EditableSceneAppState> selectionModel = listView.getSelectionModel();
    selectionModel.selectedItemProperty().addListener((observable, oldValue, newValue) ->
            selectHandler.accept(newValue));

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

    final Button removeButton = new Button();
    removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
    removeButton.setOnAction(event -> removeAppState());
    removeButton.disableProperty().bind(selectionModel.selectedItemProperty().isNull());

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

    FXUtils.addToPane(listView, this);
    FXUtils.addToPane(buttonContainer, this);

    FXUtils.addClassTo(buttonContainer, CSSClasses.DEF_HBOX);
    FXUtils.addClassTo(addButton, CSSClasses.BUTTON_WITHOUT_RIGHT_BORDER);
    FXUtils.addClassTo(removeButton, CSSClasses.BUTTON_WITHOUT_LEFT_BORDER);
    FXUtils.addClassTo(listView, CSSClasses.TRANSPARENT_LIST_VIEW);

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

示例15: RTSView

import javafx.scene.control.Button; //导入方法依赖的package包/类
public RTSView(EventBus bus, Camera camera, Collection<Sprite> sprites) {
	this.bus = bus;
	this.camera = camera;
	pane = new BorderPane();
	//TODO: read all the sprites, then add all the sprites on the root as nodes
	NodeManager menuBarManager = new MenuBarManager();
	pane.setTop(menuBarManager.getNode());

	NodeManager stackPaneManager = new StackPaneManager(sprites);
	pane.setCenter(stackPaneManager.getNode());

	NodeManager gridPaneManager = new GridPaneManager();
	pane.setBottom(gridPaneManager.getNode());




	scene = new Scene(pane, WIDTH, HEIGHT);
	// selected sprite
	Canvas selectionCanvas = new Canvas(WIDTH / 2, HEIGHT - CANVAS_HEIGHT);
	Button selectedSpriteButton = new Button();
	for(Sprite sprite : sprites){
		//TODO: get the skill component of each sprite
		if (sprite!=null&&sprite.getComponent(Images.TYPE).isPresent()){
			LtubImage LTUBImageSprite  = sprite.getComponent(Images.TYPE).get().image();
			Image imageSprite = LTUBImageSprite.getFXImage();
			selectedSpriteButton.setGraphic(new ImageView(imageSprite));
		}
	}

	initHandlers();
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:33,代码来源:RTSView.java


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