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


Java ToggleButton.isSelected方法代码示例

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


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

示例1: handle

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
@Override
public void handle(final MouseEvent event) {
    final ToggleButton button = (ToggleButton) event.getSource();
    if (button.isSelected()) {
        final FileChooser fileChooser = new FileChooser();
        fileChooser.setInitialFileName("record.wav");
        fileChooser.setInitialDirectory(new File(System.getProperty("java.io.tmpdir")));
        fileChooser.setTitle("Save File");
        final File fileToWrite = fileChooser.showSaveDialog(CoreController.getStage());
        componentOut.getLineOut().setFileToWrite(fileToWrite);
        componentOut.getLineOut().startRecord();
        button.setSelected(true);
        button.setText("Stop");
        button.setTextFill(Color.RED);
    } else {
        componentOut.getLineOut().stopRecord();
        button.setSelected(false);
        button.setText("Record");
    }
    event.consume();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:22,代码来源:Controller.java

示例2: getValue

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
@Override
public ValueType getValue() {
  ObservableList<ToggleButton> buttons = segmentedButton.getButtons();
  for (ToggleButton button : buttons) {
    if (button.isSelected()) {
      String buttonText = button.getText();

      for (ValueType toggleValue : toggleValues) {
        if (toggleValue.toString().equals(buttonText)) {
          return toggleValue;
        }
      }

    }
  }
  return null;
}
 
开发者ID:mzmine,项目名称:mzmine3,代码行数:18,代码来源:ToggleEditor.java

示例3: getValue

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
@Override
public ValueType getValue() {
  ObservableList<ToggleButton> buttons = segmentedButton.getButtons();
  for (ToggleButton button : buttons) {
    if (button.isSelected()) {
      String buttonText = button.getText();

      for (HashMap.Entry<String, ParameterSet> entry : toggleValues.entrySet()) {
        segmentedButton.getButtons().add(new ToggleButton(entry.getKey()));
        if (entry.getKey().equals(buttonText)) {
          return (ValueType) entry.getKey();
        }
      }

    }
  }
  return null;
}
 
开发者ID:mzmine,项目名称:mzmine3,代码行数:19,代码来源:ToggleParameterSetEditor.java

示例4: deleteOverlayButton_onAction

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
@FXML
void deleteOverlayButton_onAction(ActionEvent event) {
	LinkedList<File> overlayFiles = new LinkedList<File>();

	for (Node overlay : overlayViewFlowPane.getChildren()) {
		ToggleButton overlayButton = (ToggleButton) overlay;
		if (overlayButton.isSelected())
			overlayFiles.add((File) overlayButton.getUserData());
	}

	if (confirmDelete(overlayFiles)) {
		for (File file : overlayFiles) {
			log.info("Deleting: " + file.getName());
			file.delete();
		}

		loadImages(overlayTreeView.getSelectionModel().getSelectedItem());
	}
}
 
开发者ID:RPTools,项目名称:tokentool,代码行数:20,代码来源:ManageOverlays_Controller.java

示例5: handleBtnOverlayPressed

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
/**
 * Perform the display of overlay after toggleButton is pressed.
 *
 * @param button
 *            The button.
 */
private void handleBtnOverlayPressed(final ToggleButton button) {
	if (button.isSelected()) {
		String btnId = button.getId();
		int buttonPosition;

		switch (btnId) {
		case "mBtnOverlayCircle":
			buttonPosition = 0;
			break;
		default:
			String indexStr = btnId.substring("mBtnOverlay".length());
			buttonPosition = Integer.parseInt(indexStr);
		}

		int overlayType = PreferenceUtil.getIndexedPreferenceInt(KEY_INDEXED_OVERLAY_TYPE, buttonPosition, -1);

		updateResolution(NORMAL);
		showOverlay(overlayType);
	}
	else {
		showOverlay(null);
	}
}
 
开发者ID:jeisfeld,项目名称:Augendiagnose,代码行数:30,代码来源:DisplayImageController.java

示例6: addSupport

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
/**
 * Adds support changing icons by selection.
 *
 * @param button the button.
 */
@FXThread
public static void addSupport(@NotNull final ToggleButton button) {

    final EditorConfig editorConfig = EditorConfig.getInstance();
    final CssColorTheme theme = editorConfig.getTheme();

    if (!theme.needRepaintIcons()) {
        return;
    }

    final ImageView graphic = (ImageView) button.getGraphic();
    final Image image = graphic.getImage();
    final Image original = FILE_ICON_MANAGER.getOriginal(image);

    final ObservableMap<Object, Object> properties = button.getProperties();
    properties.put(NOT_SELECTED_IMAGE, image);
    properties.put(SELECTED_IMAGE, original);

    button.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue) {
            graphic.setImage((Image) properties.get(SELECTED_IMAGE));
        } else {
            graphic.setImage((Image) properties.get(NOT_SELECTED_IMAGE));
        }
    });

    if (button.isSelected()) {
        graphic.setImage(original);
    } else {
        graphic.setImage(image);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:38,代码来源:DynamicIconSupport.java

示例7: switchMode

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
/**
 * Switch editing mode.
 */
private void switchMode(@NotNull final ActionEvent event) {

    final ToggleButton source = (ToggleButton) event.getSource();

    if (!source.isSelected()) {
        source.setSelected(true);
        return;
    }

    getToggleButtons().forEach(source, (button, arg) -> button !=
            arg, (toggleButton, arg) -> toggleButton.setSelected(false));

    final ObjectDictionary<ToggleButton, Pane> buttonToSettings = getButtonToSettings();
    final Pane settings = buttonToSettings.get(source);

    final VBox controlSettings = getControlSettings();
    final ObservableList<javafx.scene.Node> children = controlSettings.getChildren();
    children.clear();

    if (settings != null) {
        children.add(settings);
    }

    final ObjectDictionary<ToggleButton, TerrainToolControl> buttonToControl = getButtonToControl();
    final TerrainToolControl toolControl = buttonToControl.get(source);

    setToolControl(toolControl);

    if (!isShowed()) return;

    EXECUTOR_MANAGER.addJMETask(() -> {
        final Node cursorNode = getCursorNode();
        cursorNode.removeControl(TerrainToolControl.class);
        cursorNode.addControl(toolControl);
    });
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:40,代码来源:TerrainEditingComponent.java

示例8: getSelectedTypes

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
private List<ButtonType> getSelectedTypes(List<ButtonType> alreadySelected) {
    List<ButtonType> types = new ArrayList<>();
    for (ToggleButton tb : selectedButtons) {
        if (tb.isSelected()) {
            types.add((ButtonType) tb.getUserData());
        }
    }
    types.removeAll(alreadySelected);
    return types;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:11,代码来源:DialogApp.java

示例9: toggleDurianService

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
private void toggleDurianService() {
	ToggleButton btnDurianMode = controlPane.getBtnDurianMode();
	if (btnDurianMode.isSelected()) {
		btnDurianMode.textProperty().bind(durianTimer.messageProperty());
		durianTimer.restart();
	} else {
		btnDurianMode.textProperty().unbind();
		btnDurianMode.textProperty().set("Durian Notifier");
		durianTimer.cancel();
	}
}
 
开发者ID:thirdy,项目名称:blackmarket,代码行数:12,代码来源:BlackmarketApplication.java

示例10: selectPeonClass

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
/**
* Helper function, selects all Peons by defined class.
*
* Iterates through each peon in Worldentities, adds them to
* a TilePane which is generated in the ContextAreaManager
* <p>
* This function handles the Toggle Button actions of
* Miners, Guards, and Gatherers
*
* @param  toggle ToggleButton of the 
* @param  peonClass  The class of Peon to be handled by the function
* 
*/
  private void selectPeonClass(ToggleButton toggle, Class<?> peonClass) {
      if (toggle.isSelected()) {
      	clearPeonInterface("all");
          for (WorldEntity entity : World.getInstance().getWorldentities()) {
              if (entity.getClass() == peonClass) {
              	buildPeonButtons(entity);
              }
          }
          NotificationManager.notify("Selected all " + peonClass.getSimpleName() + "s");
      } else {
          clearPeonInterface(peonClass.getSimpleName());
      }
      applyPeonInterface();
  }
 
开发者ID:UQdeco2800,项目名称:minesim,代码行数:28,代码来源:PeonSelectorController.java

示例11: handleTabSelection

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
/** Indicate the active tab, notify listeners
 *  @param pressed Button that was pressed
 */
private void handleTabSelection(final ToggleButton pressed, final boolean notify)
{
    final ObservableList<Node> siblings = buttons.getChildren();
    int i = 0, selected_tab = -1;
    for (Node sibling : siblings)
    {
        final ToggleButton button = (ToggleButton) sibling;
        if (button == pressed)
        {
            // If user clicked a button that was already selected,
            // it would now be de-selected, leaving nothing selected.
            if (! pressed.isSelected())
            {   // Re-select!
                pressed.setSelected(true);
            }
            // Highlight active tab by setting it to the 'selected' color
            pressed.setStyle("-fx-color: " + JFXUtil.webRGB(selected));
            selected_tab = i;
        }
        else if (button.isSelected())
        {
            // Radio-button behavior: De-select other tabs
            button.setSelected(false);
            button.setStyle("-fx-color: " + JFXUtil.webRGB(deselected));
        }
        ++i;
    }

    final Listener safe_copy = listener;
    if (selected_tab >= 0  &&  notify  &&  safe_copy != null)
        safe_copy.tabSelected(selected_tab);
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:36,代码来源:NavigationTabs.java

示例12: maybeAddWeekday

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
private void maybeAddWeekday(List<WeekdayNum> weekdays,
                             WeekdayNum weekdayNum, ToggleButton button) {
    if (button.isSelected()) {
        weekdays.add(weekdayNum);
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:7,代码来源:RecurrenceViewSkin.java

示例13: ListWidgetChooser

import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
public ListWidgetChooser(List<CombinedListWidget<E>> listWidgets) {
    super();

    this.listWidgets = listWidgets;

    this.getStyleClass().add("listChooser");

    this.onChoose = Optional.empty();

    this.toggleGroup = new ToggleGroup();

    // prevent unselecting all buttons
    EventHandler filter = (EventHandler<ActionEvent>) actionEvent -> {
        ToggleButton source = (ToggleButton) actionEvent.getSource();
        if (source.getToggleGroup() == null || !source.isSelected()) {
            source.fire();
        }
    };

    this.iconsListButton = new ToggleButton();
    this.iconsListButton.setToggleGroup(toggleGroup);
    this.iconsListButton.getStyleClass().addAll("listIcon", "iconsList");
    this.iconsListButton
            .setOnAction(event -> {
                listWidgets.forEach(widget -> widget.showList(ListWidgetType.ICONS_LIST));
                this.onChoose.ifPresent(consumer -> consumer.accept(ListWidgetType.ICONS_LIST));
            });
    this.iconsListButton.addEventFilter(ActionEvent.ANY, filter);

    this.compactListButton = new ToggleButton();
    this.compactListButton.setToggleGroup(toggleGroup);
    this.compactListButton.getStyleClass().addAll("listIcon", "compactList");
    this.compactListButton
            .setOnAction(event -> {
                listWidgets.forEach(widget -> widget.showList(ListWidgetType.COMPACT_LIST));
                this.onChoose.ifPresent(consumer -> consumer.accept(ListWidgetType.COMPACT_LIST));
            });
    this.compactListButton.addEventFilter(ActionEvent.ANY, filter);

    this.detailsListButton = new ToggleButton();
    this.detailsListButton.setToggleGroup(toggleGroup);
    this.detailsListButton.getStyleClass().addAll("listIcon", "detailsList");
    this.detailsListButton
            .setOnAction(event -> {
                listWidgets.forEach(widget -> widget.showList(ListWidgetType.DETAILS_LIST));
                this.onChoose.ifPresent(consumer -> consumer.accept(ListWidgetType.DETAILS_LIST));
            });
    this.detailsListButton.addEventFilter(ActionEvent.ANY, filter);

    this.getChildren().setAll(iconsListButton, compactListButton, detailsListButton);

    this.choose(ListWidgetType.ICONS_LIST);
}
 
开发者ID:PhoenicisOrg,项目名称:POL-POM-5,代码行数:54,代码来源:ListWidgetChooser.java


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