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


Java ToggleGroup.selectToggle方法代码示例

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


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

示例1: bind

import javafx.scene.control.ToggleGroup; //导入方法依赖的package包/类
public void bind(final ToggleGroup toggleGroup, final String propertyName) {
    try {
        String value = props.getProperty(propertyName);
        if (value != null) {
            int selectedToggleIndex = Integer.parseInt(value);
            toggleGroup.selectToggle(toggleGroup.getToggles().get(selectedToggleIndex));
        }
    } catch (Exception ignored) {
    }
    toggleGroup.selectedToggleProperty().addListener(new InvalidationListener() {

        @Override
        public void invalidated(Observable o) {
            if (toggleGroup.getSelectedToggle() == null) {
                props.remove(propertyName);
            } else {
                props.setProperty(propertyName, Integer.toString(toggleGroup.getToggles().indexOf(toggleGroup.getSelectedToggle())));
            }
        }
    });
}
 
开发者ID:comtel2000,项目名称:mokka7,代码行数:22,代码来源:SessionManager.java

示例2: SessionConflictDialog

import javafx.scene.control.ToggleGroup; //导入方法依赖的package包/类
public SessionConflictDialog( Session scheduled, Session proposed, SessionVisuals sessionVisuals  ){
    this.rootNode.getStyleClass().add("session-conflict-dialog");

    this.sessionVisuals = sessionVisuals;

    setTitle(new Label(OTNBundle.getString("OTN.CONFLICT.SCHEDULE_CONFLICT")));

    RadioButton rbScheduled = new RadioButton(OTNBundle.getString("OTN.CONFLICT.CURRENTLY_SCHEDULED"));
    RadioButton rbProposed = new RadioButton(OTNBundle.getString("OTN.CONFLICT.PROPOSED"));

    ToggleGroup group = new ToggleGroup();
    group.getToggles().addAll(rbScheduled, rbProposed);
    group.selectToggle(rbScheduled);
    
    final VBox vBox = new VBox(
            new Label(OTNBundle.getString("OTN.CONFLICT.QUESTION")),
            sessionPane(scheduled, rbScheduled),
            sessionPane(proposed, rbProposed));
    vBox.getStyleClass().add("content");

    setContent(vBox);

    getButtons().addAll(
            createButton(OTNBundle.getString("OTN.BUTTON.CANCEL"),   () -> null),
            createButton(OTNBundle.getString("OTN.BUTTON.SCHEDULE"), () -> rbProposed.isSelected() ? proposed: scheduled));
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:27,代码来源:SessionConflictDialog.java

示例3: bind

import javafx.scene.control.ToggleGroup; //导入方法依赖的package包/类
public void bind(final ToggleGroup toggleGroup, final String propertyName) {
  try {
    String value = props.getProperty(propertyName);
    if (value != null) {
      int selectedToggleIndex = Integer.parseInt(value);
      toggleGroup.selectToggle(toggleGroup.getToggles().get(selectedToggleIndex));
    }
  } catch (Exception ignored) {
  }
  toggleGroup.selectedToggleProperty().addListener(o -> {
    if (toggleGroup.getSelectedToggle() == null) {
      props.remove(propertyName);
    } else {
      props.setProperty(propertyName, Integer.toString(toggleGroup.getToggles().indexOf(toggleGroup.getSelectedToggle())));
    }
  });
}
 
开发者ID:comtel2000,项目名称:jfxvnc,代码行数:18,代码来源:SessionContext.java

示例4: PreferenceOutputPane

import javafx.scene.control.ToggleGroup; //导入方法依赖的package包/类
@Inject
public PreferenceOutputPane(@Named("smartRadio") PreferenceRadioButton smartRadio) {
    I18nContext i18n = DefaultI18nContext.getInstance();
    ToggleGroup group = new ToggleGroup();

    RadioButton manualRadio = new RadioButton(i18n.i18n("Manually selected"));
    manualRadio.setToggleGroup(group);
    manualRadio.getStyleClass().addAll(Style.VITEM.css());
    manualRadio.setId("manualRadio");

    smartRadio.getStyleClass().addAll(Style.VITEM.css());
    smartRadio.setToggleGroup(group);
    smartRadio.setGraphic(helpIcon(DefaultI18nContext.getInstance()
            .i18n("Automatically set the destination directory to the selected PDF document directory")));
    smartRadio.getStyleClass().addAll(Style.WITH_HELP.css());

    if (isNull(group.getSelectedToggle())) {
        group.selectToggle(manualRadio);
    }

    getChildren().addAll(manualRadio, smartRadio);
    getStyleClass().addAll(Style.CONTAINER.css());
}
 
开发者ID:torakiki,项目名称:pdfsam,代码行数:24,代码来源:PreferenceOutputPane.java

示例5: ToggleButtonSample

import javafx.scene.control.ToggleGroup; //导入方法依赖的package包/类
public ToggleButtonSample() {
    // create label to show result of selected toggle button
    final Label label = new Label();
    label.setStyle("-fx-font-size: 2em;");
    // create 3 toggle buttons and a toogle group for them
    final ToggleButton tb1 = new ToggleButton("Cat");
    final ToggleButton tb2 = new ToggleButton("Dog");
    final ToggleButton tb3 = new ToggleButton("Horse");
    ToggleGroup group = new ToggleGroup();
    tb1.setToggleGroup(group);
    tb2.setToggleGroup(group);
    tb3.setToggleGroup(group);
    group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        @Override public void changed(ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle selectedToggle) {
            if(selectedToggle!=null) {
                label.setText(((ToggleButton) selectedToggle).getText());
            }
            else {
                label.setText("...");
            }
        }
    });
    // select the first button to start with
    group.selectToggle(tb1);
    // add buttons and label to grid and set their positions
    GridPane.setConstraints(tb1,0,0);
    GridPane.setConstraints(tb2,1,0);
    GridPane.setConstraints(tb3,2,0);
    GridPane.setConstraints(label,0,1,3,1);
    GridPane grid = new GridPane();
    grid.setVgap(20);
    grid.setHgap(10);
    getChildren().add(grid);
    grid.getChildren().addAll(tb1, tb2, tb3, label);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:36,代码来源:ToggleButtonSample.java

示例6: initialize

import javafx.scene.control.ToggleGroup; //导入方法依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
    // 初始化toggle button
    ToggleGroup toggleGroup = new ToggleGroup();
    toggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            Integer flag = (Integer) newValue.getUserData();
            togglePage(flag);
        } else {
            toggleGroup.selectToggle(oldValue);
        }
    });
    toggleDecompile.setToggleGroup(toggleGroup);
    toggleDecompile.setUserData(1);
    toggleRecompile.setToggleGroup(toggleGroup);
    toggleRecompile.setUserData(2);
    toggleApkSign.setToggleGroup(toggleGroup);
    toggleApkSign.setUserData(3);

    // 默认选择反编译界面
    toggleGroup.selectToggle(toggleDecompile);

    // 默认不显示打开输出目录按钮
    btnOpenDecompileOut.setVisible(false);
    btnOpenRecompileOut.setVisible(false);
    btnOpenApkSignOut.setVisible(false);
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:28,代码来源:ApkToolView.java

示例7: makeMenuBar

import javafx.scene.control.ToggleGroup; //导入方法依赖的package包/类
private HBox makeMenuBar() {
    ToggleButton tb1 = new ToggleButton("MAIN MENU");
    ToggleButton tb2 = new ToggleButton("OPTIONS");
    ToggleButton tb3 = new ToggleButton("EXTRA");
    tb1.setFont(FXGL.getUIFactory().newFont(18));
    tb2.setFont(FXGL.getUIFactory().newFont(18));
    tb3.setFont(FXGL.getUIFactory().newFont(18));

    ToggleGroup group = new ToggleGroup();
    tb1.setToggleGroup(group);
    tb2.setToggleGroup(group);
    tb3.setToggleGroup(group);

    tb1.setUserData(menuBody);
    tb2.setUserData(makeOptionsMenu());
    tb3.setUserData(makeExtraMenu());

    group.selectedToggleProperty().addListener((obs, old, newToggle) -> {
        if (newToggle == null) {
            group.selectToggle(old);
            return;
        }
        switchMenuTo((Node)newToggle.getUserData());
    });
    group.selectToggle(tb1);

    HBox hbox = new HBox(10, tb1, tb2, tb3);
    hbox.setAlignment(Pos.TOP_CENTER);
    return hbox;
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:31,代码来源:GTAVMenu.java

示例8: AddAgentsToMapTitledPane

import javafx.scene.control.ToggleGroup; //导入方法依赖的package包/类
public AddAgentsToMapTitledPane(GeographicalMarketPresentation geographicalMarketPresentation, ControllableGeographicalScenario scenario) {

        normalSelection = new ToggleButton(SELECT_BUTTON_STRING);
        addOilPump = initializeButton(ADD_FIRM_BUTTON_STRING, GeographicalFirmPortrait.OIL_IMAGE);
        addHousehold =  initializeButton(ADD_HOUSEHOLD_BUTTON_STRING, GeographicalCustomerPortrait.CUSTOMER_IMAGE);

        mouseSelection = new ToggleGroup();
        normalSelection.setToggleGroup(mouseSelection);
        addOilPump.setToggleGroup(mouseSelection);
        addHousehold.setToggleGroup(mouseSelection);

        //default to normal selection
        mouseSelection.selectToggle(normalSelection);
        currentMouseMode = new SimpleObjectProperty<>(MouseMode.SELECTION);
        //create the mouse mode "actuator"
        mouseModeSwitcher = new MouseModeSwitcher(currentMouseMode,geographicalMarketPresentation,scenario);

        //start listening
        mouseSelection.selectedToggleProperty().addListener(this);
        currentMouseMode.addListener(this);
        //add the buttons to the accordion
        HBox toggleContainer = new HBox(normalSelection,addOilPump,addHousehold);
        super.setContent(toggleContainer);

        super.setText(PANE_TITLE);



    }
 
开发者ID:CarrKnight,项目名称:MacroIIDiscrete,代码行数:30,代码来源:AddAgentsToMapTitledPane.java

示例9: createContextMenu

import javafx.scene.control.ToggleGroup; //导入方法依赖的package包/类
private void createContextMenu() {
    final Menu labelsMenu = new Menu("_Labels");
    labelsMenu.getItems().addAll(newLabelMenuItem);

    final Menu setDownloadLimitMenu = new Menu("Set Download Limit");
    final Menu setUploadLimitMenu = new Menu("Set Upload Limit");

    final ToggleGroup bandwidthAllocationGroup = new ToggleGroup();
    highMenuItem.setToggleGroup(bandwidthAllocationGroup);
    normalMenuItem.setToggleGroup(bandwidthAllocationGroup);
    lowMenuItem.setToggleGroup(bandwidthAllocationGroup);
    bandwidthAllocationGroup.selectToggle(normalMenuItem);

    final Menu bandwidthAllocationMenu = new Menu("Band_width Allocation");
    bandwidthAllocationMenu.getItems().addAll(highMenuItem, normalMenuItem, lowMenuItem,
            new SeparatorMenuItem(), setDownloadLimitMenu, setUploadLimitMenu);

    final Menu removeAndMenu = new Menu("Remove A_nd");
    removeAndMenu.getItems().addAll(deleteTorrentMenuItem, deleteTorrentAndDataMenuItem, deleteDataMenuItem);

    final Menu advancedMenu = new Menu("_Advanced");
    advancedMenu.getItems().addAll(resetBansMenuItem, clearPeerListMenuItem, setDownloadLocationMenuItem,
            setDestinationNameMenuItem, updateTorrentMenuItem);

    final ContextMenu contextMenu = new ContextMenu();
    contextMenu.getItems().addAll(openMenuItem, openContainingFolderMenuItem, new SeparatorMenuItem(),
            copyMagnetUriMenuItem, openUrlInBrowserMenuItem, new SeparatorMenuItem(),
            forceStartMenuItem, startMenuItem, pauseMenuItem, stopMenuItem, new SeparatorMenuItem(),
            moveUpQueueMenuItem, moveDownQueueMenuItem, labelsMenu, new SeparatorMenuItem(),
            bandwidthAllocationMenu, new SeparatorMenuItem(), removeMenuItem, removeAndMenu,
            new SeparatorMenuItem(), forceRecheckMenuItem, advancedMenu, new SeparatorMenuItem(),
            updateTrackerMenuItem, new SeparatorMenuItem(), propertiesMenuItem);
    contextMenu.showingProperty().addListener(obs -> {});
    torrentTable.setRowFactory(table -> {
        final TableRow<TorrentView> tableRow = new TrackerTableRow<>();
        tableRow.setContextMenu(contextMenu);
        tableRow.setOnContextMenuRequested(cme -> {
            final TorrentView torrentView = tableRow.getItem();
            if(torrentView == null) {
                contextMenu.hide();
                return;
            }
            setupMenuStates(torrentView);
            setupMenuActions(torrentView);
        });

        return tableRow;
    });
}
 
开发者ID:veroslav,项目名称:jfx-torrent,代码行数:50,代码来源:TorrentViewTable.java


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