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