當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。