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


Java Button.setVisible方法代码示例

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


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

示例1: SearchBox

import javafx.scene.control.Button; //导入方法依赖的package包/类
public SearchBox() {
    setId("SearchBox");
    getStyleClass().add("search-box");
    setMinHeight(24);
    setPrefSize(200, 24);
    setMaxSize(Control.USE_PREF_SIZE, Control.USE_PREF_SIZE);
    textBox = new TextField();
    textBox.setPromptText("Search");
    clearButton = new Button();
    clearButton.setVisible(false);
    getChildren().addAll(textBox, clearButton);
    clearButton.setOnAction(new EventHandler<ActionEvent>() {                
        @Override public void handle(ActionEvent actionEvent) {
            textBox.setText("");
            textBox.requestFocus();
        }
    });
    textBox.textProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            clearButton.setVisible(textBox.getText().length() != 0);
        }
    });
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:24,代码来源:SearchBoxSample.java

示例2: getCoordinatesCalculatePathShowDirectionsAndHidePanel

import javafx.scene.control.Button; //导入方法依赖的package包/类
private void getCoordinatesCalculatePathShowDirectionsAndHidePanel(final Pane path_choice_pane,
                                                                   final TextField txt_from, final TextField txt_to,
                                                                   final Button btn_get_coords_find_path) {
    final String addressOrigin = txt_from.getText();
    final String addressDestination = txt_to.getText();

    final DirectionsRequest directionsRequest =
            new DirectionsRequest(addressOrigin, addressDestination, TravelModes.DRIVING);

    directionsPane = mapComponent.getDirec(); // TODO: 11/10/2017 IT HAS TO BE CLEARED!
    directionsService = new DirectionsService();
    directionsRenderer = new DirectionsRenderer(true, map, directionsPane);
    directionsService.getRoute(directionsRequest, this, directionsRenderer);

    if (!addressOrigin.equals("") || !addressDestination.equals("")) {
        path_choice_pane.setVisible(false);
        btn_get_coords_find_path.setVisible(false);
    }
}
 
开发者ID:Evegen55,项目名称:main_carauto_board,代码行数:20,代码来源:GmapfxController.java

示例3: initControls

import javafx.scene.control.Button; //导入方法依赖的package包/类
private void initControls(final Button btn_clear_directions, final Button btn_show_directions,
                              final Button btn_find_path, final Button btn_clear_path, final Pane path_choice_pane,
                              final Button btn_get_coords_find_path, final TextField txt_from, final TextField txt_to) {
        //first thing to do
        path_choice_pane.setVisible(false);
        btn_get_coords_find_path.setVisible(false);

        btn_clear_directions.setOnAction(action -> {
//            directionsRenderer.getJSObject().eval("hideDirections()");
            //or - in order to avoid check dir renderer for null
            map.hideDirectionsPane();
        });

        btn_show_directions.setOnAction(action -> map.showDirectionsPane());

        //clear directions
        //clear route
        //clear texts - text fields always with ""
        //show pane with path choice
        btn_find_path.setOnAction(action -> {
            clearPath();
            txt_from.clear();
            txt_to.clear();
            path_choice_pane.setVisible(true);
            btn_get_coords_find_path.setVisible(true);

            //text fields are always not null but "" because we invoked clear()
            btn_get_coords_find_path.setOnAction(btn_action ->
                    getCoordinatesCalculatePathShowDirectionsAndHidePanel(path_choice_pane, txt_from,
                            txt_to, btn_get_coords_find_path));

            //add text fields to a listener
            MOUSE_CLCK_FOR_GET_COORD_LISTENER.setTxt_from(txt_from);
            MOUSE_CLCK_FOR_GET_COORD_LISTENER.setTxt_to(txt_to);
        });

        btn_clear_path.setOnAction(action -> clearPath());
    }
 
开发者ID:Evegen55,项目名称:main_carauto_board,代码行数:39,代码来源:GmapfxController.java

示例4: addFeature

import javafx.scene.control.Button; //导入方法依赖的package包/类
public void addFeature(final Feature feature) {
    features.add(feature);

    ToggleSwitch toggleSwitch = new ToggleSwitch();
    toggleSwitch.setAlignment(Pos.CENTER_LEFT);
    toggleSwitch.textProperty().bindBidirectional(feature.nameProperty());
    toggleSwitch.selectedProperty().bindBidirectional(feature.activeProperty());
    Util.installWindowDragListener(toggleSwitch);
    toggleSwitch.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    HBox.setHgrow(toggleSwitch, Priority.ALWAYS);

    Button showSlidesButton = FontAwesomeIconFactory.get().createIconButton(FontAwesomeIcon.FILM);
    showSlidesButton.getStyleClass().add("show-slides-button");
    showSlidesButton.setVisible(false);
    HBox.setHgrow(showSlidesButton, Priority.NEVER);
    Util.installWindowDragListener(showSlidesButton);

    HBox featureBox = new HBox(10, toggleSwitch, showSlidesButton);
    featureBox.setAlignment(Pos.TOP_CENTER);

    getChildren().add(featureBox);

    Optional<SlidesEntry> slidesEntry = MovieApp.slidesDatabase.getSlideEntry(feature.getId());
    if (slidesEntry.isPresent()) {
        SlidesEntry entry = slidesEntry.get();
        if (!entry.getSlides().isEmpty()) {
            showSlidesButton.setVisible(true);
            showSlidesButton.setOnAction(evt -> SlidesViewer.showSlides(entry, true));

            toggleSwitch.selectedProperty().addListener(it -> {
                if (toggleSwitch.isSelected()) {
                    SlidesViewer.showSlides(entry, false);
                }
            });
        } else {
            toggleSwitch.selectedProperty().addListener(it -> {
                if (toggleSwitch.isSelected()) {
                    SlidesViewer.showSlides(null, false);
                }
            });
        }
    } else {
        toggleSwitch.selectedProperty().addListener(it -> {
            if (toggleSwitch.isSelected()) {
                SlidesViewer.showSlides(null, false);
            }
        });
    }
}
 
开发者ID:hendrikebbers,项目名称:ExtremeGuiMakeover,代码行数:50,代码来源:FeaturesPane.java


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