javafx.scene.control.Button#setTooltip ( )源码实例Demo

下面列出了javafx.scene.control.Button#setTooltip ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jmonkeybuilder   文件: AbstractFileEditor.java
/**
 * Create the save action.
 *
 * @return the button
 */
protected @NotNull Button createSaveAction() {

    final Button action = new Button();
    action.setTooltip(new Tooltip(Messages.FILE_EDITOR_ACTION_SAVE + " (Ctrl + S)"));
    action.setOnAction(event -> save());
    action.setGraphic(new ImageView(Icons.SAVE_16));
    action.disableProperty().bind(dirtyProperty().not());

    FXUtils.addClassesTo(action, CssClasses.FLAT_BUTTON,
            CssClasses.FILE_EDITOR_TOOLBAR_BUTTON);

    DynamicIconSupport.addSupport(action);

    return action;
}
 
源代码2 项目: phoebus   文件: StateCell.java
private Button createButton(final String icon, final String tooltip, final ScanAction action)
{
    final Button button = new Button();
    button.setMinSize(ButtonBase.USE_PREF_SIZE, ButtonBase.USE_PREF_SIZE);
    button.setPrefHeight(20);
    button.setGraphic(ImageCache.getImageView(StateCell.class, icon));
    button.setTooltip(new Tooltip(tooltip));
    button.setOnAction(event ->
    {
        try
        {
            action.perform(getTableRow().getItem().id.get());
        }
        catch (Exception ex)
        {
            logger.log(Level.WARNING, "Failed: " + tooltip, ex);
        }
    });
    return button;
}
 
源代码3 项目: phoebus   文件: AlarmTreeView.java
private ToolBar createToolbar()
{
    final Button collapse = new Button("",
            ImageCache.getImageView(AlarmUI.class, "/icons/collapse.png"));
    collapse.setTooltip(new Tooltip("Collapse alarm tree"));
    collapse.setOnAction(event ->
    {
        for (TreeItem<AlarmTreeItem<?>> sub : tree_view.getRoot().getChildren())
            sub.setExpanded(false);
    });

    final Button show_alarms = new Button("",
            ImageCache.getImageView(AlarmUI.class, "/icons/expand_alarms.png"));
    show_alarms.setTooltip(new Tooltip("Expand alarm tree to show active alarms"));
    show_alarms.setOnAction(event -> expandAlarms(tree_view.getRoot()));
    return new ToolBar(no_server, ToolbarHelper.createSpring(), collapse, show_alarms);
}
 
源代码4 项目: Quelea   文件: BasicSongPanel.java
/**
 * Get the sequence dialog button.
 *
 * @return the sequence button
 */
private Button getSequenceButton() {
    Button ret = new Button("", new ImageView(new Image("file:icons/edit32.png", 24, 24, false, true)));
    ret.setTooltip(new Tooltip(LabelGrabber.INSTANCE.getLabel("sequence.tooltip")));
    ret.setOnAction((event) -> {
        SequenceSelectionDialog sequenceSelectionDialog = new SequenceSelectionDialog();
        sequenceSelectionDialog.showAndWait();
        if (sequenceSelectionDialog.isFinished()) {
            StringBuilder sb = new StringBuilder();
            for (String s : sequenceSelectionDialog.getChosenSequence()) {
                sb.append(s).append(" ");
            }
            getSequenceField().setText(sb.toString().trim());
        }
    });
    return ret;
}
 
源代码5 项目: BlockMap   文件: Pin.java
@Override
protected PopOver initInfo() {
	PopOver info = super.initInfo();
	GridPane content = new GridPane();
	content.getStyleClass().add("grid");

	content.add(new Label("Player position:"), 0, 2);

	Vector3dc position = player.getPosition();
	Button jumpButton = new Button(position.toString());
	jumpButton.setTooltip(new Tooltip("Click to go there"));
	content.add(jumpButton, 1, 2);
	jumpButton.setOnAction(e -> {
		Vector2d spawnpoint = new Vector2d(position.x(), position.z());
		AABBd frustum = viewport.frustumProperty.get();
		viewport.translationProperty.set(spawnpoint.negate().add((frustum.maxX - frustum.minX) / 2, (frustum.maxY - frustum.minY) / 2));
		info.hide();
	});

	info.setContentNode(content);
	return info;
}
 
源代码6 项目: phoebus   文件: StringTable.java
private Button createToolbarButton(final String id, final String tool_tip, final EventHandler<ActionEvent> handler)
{
    final Button button = new Button();
    try
    {
        // Icons are not centered inside the button until the
        // button is once pressed, or at least focused via "tab"
        button.setGraphic(ImageCache.getImageView(ImageCache.class, "/icons/" + id + ".png"));

        // Using the image as a background like this centers the image,
        // but replaces the complete characteristic button outline with just the icon.
        // button.setBackground(new Background(new BackgroundImage(new Image(Activator.getIcon(id)),
        //                      BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT,
        //                      BackgroundPosition.CENTER,
        //                      new BackgroundSize(16, 16, false, false, false, false))));
        button.setTooltip(new Tooltip(tool_tip));
    }
    catch (Exception ex)
    {
        logger.log(Level.WARNING, "Cannot load icon for " + id, ex);
        button.setText(tool_tip);
    }
    // Without defining the button size, the buttons may start out zero-sized
    // until they're first pressed/tabbed
    button.setMinSize(35, 25);
    button.setOnAction(handler);

    // Forcing a layout of the button on later UI ticks
    // tends to center the image
    Platform.runLater(() -> Platform.runLater(button::requestLayout));

    return button;
}
 
源代码7 项目: phoebus   文件: ExecuteDisplayAction.java
public static Button asButton(final DisplayEditorInstance editor)
{
    final Runnable action = new ExecuteDisplayAction(editor);
    final Button button = new Button();
    button.setGraphic(new ImageView(icon));
    button.setTooltip(new Tooltip(Messages.Run));
    button.setOnAction(event -> action.run());
    return button;
}
 
源代码8 项目: phoebus   文件: FilesList.java
private Node createButtons()
{
    final Button attach = new Button(Messages.AttachFile);
    final Button remove = new Button(Messages.RemoveSelected, ImageCache.getImageView(ImageCache.class, "/icons/delete.png"));

    attach.setTooltip(new Tooltip(Messages.AddImageLog));
    remove.setTooltip(new Tooltip(Messages.RemoveSelectedFiles));

    // Only enable 'remove' when file(s) selected
    remove.disableProperty().bind(Bindings.isEmpty(files.getSelectionModel().getSelectedItems()));

    attach.setOnAction(event ->
    {
        final FileChooser dialog = new FileChooser();
        dialog.setInitialDirectory(new File(System.getProperty("user.home")));
        final List<File> to_add = dialog.showOpenMultipleDialog(getScene().getWindow());
        if (null != to_add)
            files.getItems().addAll(to_add);
    });

    remove.setOnAction(event ->
    {
        final List<File> selected = new ArrayList<>(files.getSelectionModel().getSelectedItems());
        if (selected.size() > 0)
            files.getItems().removeAll(selected);
    });

    final HBox row = new HBox(10, attach, remove);
    // Have buttons equally split the available width
    attach.setMaxWidth(Double.MAX_VALUE);
    remove.setMaxWidth(Double.MAX_VALUE);
    HBox.setHgrow(attach, Priority.ALWAYS);
    HBox.setHgrow(remove, Priority.ALWAYS);

    return row;
}
 
源代码9 项目: LogFX   文件: Arrow.java
public static Button arrowButton( Direction direction,
                                  EventHandler<ActionEvent> eventEventHandler,
                                  String toolTipText ) {
    Button button = new Button( "", new Arrow( direction ) );
    button.setFont( Font.font( 4.0 ) );
    button.setMinWidth( 16 );
    button.setMinHeight( 8 );
    button.setTooltip( new Tooltip( toolTipText ) );
    button.getTooltip().setFont( Font.font( 12.0 ) );
    button.setOnAction( eventEventHandler );
    return button;
}
 
源代码10 项目: phoebus   文件: SampleView.java
public SampleView(final Model model)
{
    this.model = model;

    items.setOnAction(event -> select(items.getSelectionModel().getSelectedItem()));

    final Button refresh = new Button(Messages.SampleView_Refresh);
    refresh.setTooltip(new Tooltip(Messages.SampleView_RefreshTT));
    refresh.setOnAction(event -> update());

    final Label label = new Label(Messages.SampleView_Item);
    final HBox top_row = new HBox(5, label, items, refresh);
    top_row.setAlignment(Pos.CENTER_LEFT);

    // Combo should fill the available space.
    // Tried HBox.setHgrow(items, Priority.ALWAYS) etc.,
    // but always resulted in shrinking the label and button.
    // -> Explicitly compute combo width from available space
    //    minus padding and size of label, button
    items.prefWidthProperty().bind(top_row.widthProperty().subtract(20).subtract(label.widthProperty()).subtract(refresh.widthProperty()));
    items.prefHeightProperty().bind(refresh.heightProperty());

    createSampleTable();

    top_row.setPadding(new Insets(5));
    sample_count.setPadding(new Insets(5));
    sample_table.setPadding(new Insets(0, 5, 5, 5));
    VBox.setVgrow(sample_table, Priority.ALWAYS);
    getChildren().setAll(top_row, sample_count, sample_table);

    // TODO Add 'export' to sample view? CSV in a format usable by import

    update();
}
 
源代码11 项目: chart-fx   文件: DataSetMeasurements.java
protected void addParameterValueEditorItems() {
    if (measType.getControlParameterNames().isEmpty()) {
        return;
    }
    final String toolTip = "math function parameter - usually in units of the x-axis";
    for (String controlParameter : measType.getControlParameterNames()) {
        final Label label = new Label(controlParameter + ": "); // NOPMD - done only once
        final CheckedNumberTextField parameterField = new CheckedNumberTextField(1.0); // NOPMD - done only once
        label.setTooltip(new Tooltip(toolTip)); // NOPMD - done only once
        GridPane.setConstraints(label, 0, lastLayoutRow);
        parameterField.setTooltip(new Tooltip(toolTip)); // NOPMD - done only once
        GridPane.setConstraints(parameterField, 1, lastLayoutRow++);

        this.parameterFields.add(parameterField);
        this.getDialogContentBox().getChildren().addAll(label, parameterField);
    }
    switch (measType) {
    case TRENDING_SECONDS:
    case TRENDING_TIMEOFDAY_UTC:
    case TRENDING_TIMEOFDAY_LOCAL:
        parameterFields.get(0).setText("600.0");
        parameterFields.get(1).setText("10000");
        Button resetButton = new Button("reset history");
        resetButton.setTooltip(new Tooltip("press to reset trending history"));
        resetButton.setOnAction(evt -> this.trendingDataSet.reset());
        GridPane.setConstraints(resetButton, 1, lastLayoutRow++);
        this.getDialogContentBox().getChildren().addAll(resetButton);
        break;
    default:
        break;
    }
}
 
源代码12 项目: chart-fx   文件: WaterfallPerformanceSample.java
private ToolBar getTestToolBar(final Scene scene) {
    ToolBar testVariableToolBar = new ToolBar();
    final Button fillDataSet = new Button("fill");
    fillDataSet.setTooltip(new Tooltip("update data set with demo data"));
    fillDataSet.setOnAction(evt -> dataSet.fillTestData());

    final Button stepDataSet = new Button("step");
    stepDataSet.setTooltip(new Tooltip("update data set by one row"));
    stepDataSet.setOnAction(evt -> dataSet.step());

    // repetitively generate new data
    final Button periodicTimer = new Button("timer");
    periodicTimer.setTooltip(new Tooltip("update data set periodically"));
    periodicTimer.setOnAction(evt -> updateTimer(false));

    updatePeriod.valueProperty().addListener((ch, o, n) -> updateTimer(true));
    updatePeriod.setEditable(true);
    updatePeriod.setPrefWidth(80);

    final ProfilerInfoBox profilerInfoBox = new ProfilerInfoBox(DEBUG_UPDATE_RATE);
    profilerInfoBox.setDebugLevel(DebugLevel.VERSION);

    final Pane spacer = new Pane();
    HBox.setHgrow(spacer, Priority.ALWAYS);
    testVariableToolBar.getItems().addAll(fillDataSet, stepDataSet, periodicTimer, updatePeriod, new Label("[ms]"), spacer, profilerInfoBox);
    return testVariableToolBar;
}
 
源代码13 项目: phoebus   文件: ImageList.java
private Node createImageSection()
{
    preview.setPreserveRatio(true);
    preview.setManaged(false);

    final Button removeImage   = new Button(Messages.Remove, ImageCache.getImageView(ImageCache.class, "/icons/delete.png"));
    removeImage.setTooltip(new Tooltip(Messages.RemoveImage));
    removeImage.setOnAction(event ->
    {
        final Image image = preview.getImage();
        if (image != null)
        {
            images.getItems().remove(image);
            selectFirstImage();
        }
    });

    final StackPane left = new StackPane(preview, removeImage);
    // Image in background fills the area
    preview.setX(5);
    preview.setY(5);
    preview.fitWidthProperty().bind(left.widthProperty());
    preview.fitHeightProperty().bind(left.heightProperty());
    // Remove button on top, upper right corner
    StackPane.setAlignment(removeImage, Pos.TOP_RIGHT);
    StackPane.setMargin(removeImage, new Insets(5));

    images.setPlaceholder(new Label(Messages.NoImages));
    images.setStyle("-fx-control-inner-background-alt: #f4f4f4");
    images.setStyle("-fx-control-inner-background: #f4f4f4");
    images.setCellFactory(param -> new ImageCell(preview));

    // Show selected image in preview
    preview.imageProperty().bind(images.getSelectionModel().selectedItemProperty());
    // Enable button if something is selected
    removeImage.disableProperty().bind(Bindings.isEmpty(images.getSelectionModel().getSelectedItems()));

    VBox.setVgrow(images, Priority.ALWAYS);
    final VBox right = new VBox(new Label(Messages.ImagesTitle), images);
    right.setPadding(new Insets(5));

    final SplitPane split = new SplitPane(left, right);
    split.setDividerPositions(0.7);
    return split;
}
 
源代码14 项目: Open-Lowcode   文件: CActionButton.java
@Override
public Node getNode(
		PageActionManager actionmanager,
		CPageData inputdata,
		Window parentwindow,
		TabPane[] parenttabpanes,
		CollapsibleNode nodetocollapsewhenactiontriggered) {

	if (this.conditionalshow) {
		DataElt thiselement = inputdata.lookupDataElementByName(conditionalshowdatareference.getName());
		if (thiselement == null)
			throw new RuntimeException(String.format(
					"could not find any page data with name = %s" + conditionalshowdatareference.getName()));
		if (!thiselement.getType().equals(conditionalshowdatareference.getType()))
			throw new RuntimeException(
					String.format("page data with name = %s does not have expected %s type, actually found %s",
							conditionalshowdatareference.getName(), conditionalshowdatareference.getType(),
							thiselement.getType()));
		ChoiceDataElt<?> thischoiceelement = (ChoiceDataElt<?>) thiselement;
		if (thischoiceelement.getStoredValue().compareTo("YES") != 0)
			return new Label("");
	}

	button = new Button(label);
	button.setStyle("-fx-base: #ffffff; -fx-hover-base: #ddeeff;");
	button.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE);
	button.textOverrunProperty().set(OverrunStyle.CLIP);
	// button.setMinWidth((new
	// Text(this.label).getBoundsInLocal().getWidth()+20)*1.3);
	if (tooltip != null)
		button.setTooltip(new Tooltip("tooltip"));
	if (!this.hasconfirmationmessage) {
		if (action != null) {
			actionmanager.registerEvent(button, action);
			if (callback != null)
				actionmanager.registerCallback(button, callback);
			buttonhandler = new ButtonHandler(actionmanager);
			button.setOnMouseClicked(buttonhandler);
		}
		if (inlineaction != null) {
			if (nodetocollapsewhenactiontriggered != null)
				inlineaction.setNodeToCollapse(nodetocollapsewhenactiontriggered);
			if (this.forcepopuphidewheninline) {
				actionmanager.registerInlineActionwithPopupClose(button, inlineaction);
			} else {
				actionmanager.registerInlineAction(button, inlineaction);
			}
			buttonhandler = new ButtonHandler(actionmanager);
			button.setOnMouseClicked(buttonhandler);
		}
	}
	if (this.hasconfirmationmessage) {
		button.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
				Alert alert = new Alert(AlertType.CONFIRMATION);
				alert.setTitle("User Confirmation");
				alert.setContentText(confirmationmessage);
				ButtonType continuetype = new ButtonType(confirmationmessagecontinuelabel);
				ButtonType stoptype = new ButtonType(confirmationmessagestoplabel);
				alert.getButtonTypes().setAll(continuetype, stoptype);
				Optional<ButtonType> result = alert.showAndWait();
				if (result.get() == continuetype) {

					if (action != null) {
						if (callback != null)
							actionmanager.directfireEvent(action, callback);
						if (callback == null)
							actionmanager.directfireEvent(action);
					}
					if (inlineaction != null) {
						if (forcepopuphidewheninline)
							inlineaction.forcePopupClose();
						actionmanager.directfireInlineEvent(inlineaction);
					}
				}

			}

		});
	}

	return button;
}
 
源代码15 项目: Quelea   文件: BasicSongPanel.java
private Button getNonBreakingLineButton() {
    Button ret = new Button("", new ImageView(new Image("file:icons/nonbreakline.png", 24, 24, false, true)));
    Utils.setToolbarButtonStyle(ret);
    ret.setTooltip(new Tooltip(LabelGrabber.INSTANCE.getLabel("nonbreak.tooltip")));
    ret.setOnAction((event) -> {
        int caretPos = lyricsArea.getArea().getTextArea().getCaretPosition();
        String[] parts = lyricsArea.getTextAndChords().split("\n");
        int lineIndex = lineFromPos(lyricsArea.getTextAndChords(), caretPos);
        String line = parts[lineIndex];
        if (line.trim().isEmpty()) {
            Platform.runLater(new Runnable() {

                @Override
                public void run() {
                    lyricsArea.getArea().getTextArea().replaceText(caretPos, caretPos, "<>");
                    lyricsArea.getArea().refreshStyle();
                }
            });
        } else {
            int nextLinePos = nextLinePos(lyricsArea.getTextAndChords(), caretPos);
            if (nextLinePos >= lyricsArea.getTextAndChords().length()) {
                Platform.runLater(new Runnable() {

                    @Override
                    public void run() {
                        lyricsArea.getArea().getTextArea().replaceText(nextLinePos, nextLinePos, "\n<>\n");
                        lyricsArea.getArea().refreshStyle();
                    }
                });
            } else {
                Platform.runLater(new Runnable() {

                    @Override
                    public void run() {
                        lyricsArea.getArea().getTextArea().replaceText(nextLinePos, nextLinePos, "<>\n");
                        lyricsArea.getArea().refreshStyle();
                    }
                });
            }
        }
    });
    return ret;
}
 
源代码16 项目: mzmine3   文件: SpectraBottomPanel.java
SpectraBottomPanel(SpectraVisualizerWindow masterFrame, RawDataFile dataFile) {

    // super(new BorderLayout());
    this.dataFile = dataFile;
    this.masterFrame = masterFrame;

    // setBackground(Color.white);

    topPanel = new FlowPane();
    // topPanel.setBackground(Color.white);
    // topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
    setCenter(topPanel);

    // topPanel.add(Box.createHorizontalStrut(10));

    Button prevScanBtn = new Button(leftArrow);
    // prevScanBtn.setBackground(Color.white);
    // prevScanBtn.setFont(smallFont);

    // topPanel.add(Box.createHorizontalGlue());

    Label featureListLabel = new Label("Feature list: ");

    peakListSelector = new ComboBox<PeakList>(
        MZmineCore.getProjectManager().getCurrentProject().getFeatureLists());
    // peakListSelector.setBackground(Color.white);
    // peakListSelector.setFont(smallFont);
    peakListSelector.setOnAction(
        e -> masterFrame.loadPeaks(peakListSelector.getSelectionModel().getSelectedItem()));

    processingCbx = new CheckBox("Enable Processing");
    processingCbx.setTooltip(new Tooltip("Enables quick scan processing."));
    processingCbx.setOnAction(e -> masterFrame.enableProcessing());
    updateProcessingCheckbox();

    processingParametersBtn = new Button("Spectra processing");
    processingParametersBtn
        .setTooltip(new Tooltip("Set the parameters for quick spectra processing."));
    processingParametersBtn.setOnAction(e -> masterFrame.setProcessingParams());
    updateProcessingButton();

    // topPanel.add(Box.createHorizontalGlue());

    Button nextScanBtn = new Button(rightArrow);
    nextScanBtn.setOnAction(e -> masterFrame.loadNextScan());

    topPanel.getChildren().addAll(prevScanBtn, featureListLabel, peakListSelector, processingCbx,
        processingParametersBtn, nextScanBtn);

    // nextScanBtn.setBackground(Color.white);
    // nextScanBtn.setFont(smallFont);

    // topPanel.add(Box.createHorizontalStrut(10));

    bottomPanel = new FlowPane();
    // bottomPanel.setBackground(Color.white);
    // bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
    setBottom(bottomPanel);

    // bottomPanel.add(Box.createHorizontalGlue());

    Label msmsLabel = new Label("MS/MS: ");

    msmsSelector = new ComboBox<String>();
    // msmsSelector.setBackground(Color.white);
    // msmsSelector.setFont(smallFont);

    Button showButton = new Button("Show");
    bottomPanel.getChildren().addAll(msmsLabel, msmsSelector, showButton);

    // showButton.setBackground(Color.white);
    showButton.setOnAction(e -> {
      String selectedScanString = msmsSelector.getSelectionModel().getSelectedItem();
      if (selectedScanString == null)
        return;

      int sharpIndex = selectedScanString.indexOf('#');
      int commaIndex = selectedScanString.indexOf(',');
      selectedScanString = selectedScanString.substring(sharpIndex + 1, commaIndex);
      int selectedScan = Integer.valueOf(selectedScanString);

      SpectraVisualizerModule.showNewSpectrumWindow(dataFile, selectedScan);
    });
    // showButton.setFont(smallFont);

    // bottomPanel.add(Box.createHorizontalGlue());

  }
 
源代码17 项目: mzmine3   文件: ProductIonFilterVisualizerWindow.java
public ProductIonFilterVisualizerWindow(RawDataFile dataFile, ParameterSet parameters) {
  borderPane = new BorderPane();
  scene = new Scene(borderPane);
  setScene(scene);

  this.dataFile = dataFile;

  // Retrieve parameter's values
  Range<Double> rtRange =
      parameters.getParameter(ProductIonFilterParameters.retentionTimeRange).getValue();
  Range<Double> mzRange = parameters.getParameter(ProductIonFilterParameters.mzRange).getValue();
  Object xAxisType = parameters.getParameter(ProductIonFilterParameters.xAxisType).getValue();

  mzDifference = parameters.getParameter(ProductIonFilterParameters.mzDifference).getValue();

  targetedMZ_List =
      parameters.getParameter(ProductIonFilterParameters.targetedMZ_List).getValue();
  targetedNF_List =
      parameters.getParameter(ProductIonFilterParameters.targetedNF_List).getValue();

  fileName = parameters.getParameter(ProductIonFilterParameters.fileName).getValue();

  basePeakPercent =
      parameters.getParameter(ProductIonFilterParameters.basePeakPercent).getValue();

  // Set window components
  dataset = new ProductIonFilterDataSet(dataFile, xAxisType, rtRange, mzRange, this, mzDifference,
      targetedMZ_List, targetedNF_List, basePeakPercent, fileName);

  productIonFilterPlot = new ProductIonFilterPlot(this);
  productIonFilterPlot.setAxisTypes(xAxisType);
  productIonFilterPlot.addProductionFilterDataSet(dataset);
  productIonFilterPlot.setMenuItems();
  borderPane.setCenter(productIonFilterPlot);

  toolBar = new ToolBar();
  toolBar.setOrientation(Orientation.VERTICAL);
  Button highlightPrecursorBtn = new Button(null, new ImageView(PRECURSOR_MASS_ICON));
  highlightPrecursorBtn.setTooltip(new Tooltip("Highlight selected precursor mass range"));
  highlightPrecursorBtn.setOnAction(e -> {
    ProductIonFilterSetHighlightDialog dialog =
        new ProductIonFilterSetHighlightDialog(this, productIonFilterPlot, "HIGHLIGHT_PRECURSOR");
    dialog.show();
  });
  toolBar.getItems().add(highlightPrecursorBtn);
  borderPane.setRight(toolBar);

  MZmineCore.getTaskController().addTask(dataset, TaskPriority.HIGH);

  updateTitle();

  // Add the Windows menu
  WindowsMenu.addWindowsMenu(getScene());

  // get the window settings parameter
  ParameterSet paramSet =
      MZmineCore.getConfiguration().getModuleParameters(ProductIonFilterVisualizerModule.class);
  WindowSettingsParameter settings =
      paramSet.getParameter(ProductIonFilterParameters.windowSettings);

  // update the window and listen for changes
  settings.applySettingsToWindow(this);

}
 
源代码18 项目: phoebus   文件: PhoebusApplication.java
private ToolBar createToolbar() {
    final ToolBar toolBar = new ToolBar();

    ImageView homeIcon = ImageCache.getImageView(ImageCache.class, "/icons/home.png");
    homeIcon.setFitHeight(16.0);
    homeIcon.setFitWidth(16.0);
    home_display_button = new Button(null, homeIcon);
    home_display_button.setTooltip(new Tooltip(Messages.HomeTT));
    toolBar.getItems().add(home_display_button);

    final TopResources homeResource = TopResources.parse(Preferences.home_display);

    home_display_button.setOnAction(event -> openResource(homeResource.getResource(0), false));

    top_resources_button = new MenuButton(null, ImageCache.getImageView(getClass(), "/icons/fldr_obj.png"));
    top_resources_button.setTooltip(new Tooltip(Messages.TopResources));
    top_resources_button.setDisable(true);
    toolBar.getItems().add(top_resources_button);

    layout_menu_button = new MenuButton(null, ImageCache.getImageView(getClass(), "/icons/layouts.png"));
    layout_menu_button.setTooltip(new Tooltip(Messages.LayoutTT));
    toolBar.getItems().add(layout_menu_button);

    // Contributed Entries
    ToolbarEntryService.getInstance().listToolbarEntries().forEach((entry) -> {
        final AtomicBoolean open_new = new AtomicBoolean();

        // If entry has icon, use that with name as tool tip.
        // Otherwise use the label as button text.
        final Button button = new Button();
        final Image icon = entry.getIcon();
        if (icon == null)
            button.setText(entry.getName());
        else
        {
            button.setGraphic(new ImageView(icon));
            button.setTooltip(new Tooltip(entry.getName()));
        }

        // Want to handle button presses with 'Control' in different way,
        // but action event does not carry key modifier information.
        // -> Add separate event filter to remember the 'Control' state.
        button.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
            open_new.set(event.isControlDown());
            // Still allow the button to react by 'arming' it
            button.arm();
        });

        button.setOnAction((event) -> {
            try {
                // Future<?> future = executor.submit(entry.getActions());

                if (open_new.get()) { // Invoke with new stage
                    final Window existing = DockPane.getActiveDockPane().getScene().getWindow();

                    final Stage new_stage = new Stage();
                    DockStage.configureStage(new_stage);
                    entry.call();
                    // Position near but not exactly on top of existing stage
                    new_stage.setX(existing.getX() + 10.0);
                    new_stage.setY(existing.getY() + 10.0);
                    new_stage.show();
                } else
                    entry.call();
            } catch (Exception ex) {
                logger.log(Level.WARNING, "Error invoking toolbar " + entry.getName(), ex);
            }
        });

        toolBar.getItems().add(button);
    });

    toolBar.setPrefWidth(600);
    return toolBar;
}
 
源代码19 项目: Lipi   文件: MarkdownEditorControl.java
private void setupImageInsertButton() {

        imageInsertButton = new Button("Insert Image");

        imageInsertButton.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                FileChooser fileChooser = new FileChooser();
                fileChooser.setTitle("Open Resource File");
                fileChooser.getExtensionFilters().addAll(
                        new FileChooser.ExtensionFilter("Image Files", "*.png", "*.jpg", "*.gif")
                );
                File selectedFile = fileChooser.showOpenDialog(new Stage());
                if (selectedFile != null) {
                    try {
                        File dir = new File(blogDir + "/static/images/" + new SimpleDateFormat("yyyy_MM_dd").format(new Date()));
                        dir.mkdirs();
                        FileUtils.copyFileToDirectory(selectedFile, dir);
                        String copiedFile = dir.getCanonicalPath() + "/" + selectedFile.getName();

                        TextInputDialog dialog = new TextInputDialog("Image Alt Text");
                        dialog.setTitle("Image Description Input Dialog");
                        dialog.setHeaderText("ALT TEXT for the Image");
                        dialog.setContentText("Please enter a small description:");

                        String altText = "";
                        // Traditional way to get the response value.
                        Optional<String> result = dialog.showAndWait();
                        if (result.isPresent()) {
                            altText = result.get();
                        }
                        setMdText(getMdText() + "![" + altText + "](file://" + copiedFile + ")");

                    } catch (IOException e1) {
                        ExceptionAlerter.showException(e1);
                    }
                }
            }
        });
        imageInsertButton.setTooltip(new Tooltip("Coming soon!"));

    }
 
源代码20 项目: chart-fx   文件: ChartPerformanceBenchmark.java
private Button startTestButton(final String label, final int[] nSamplesTest, final long updatePeriod) {
    final Button startTimer = new Button(label);
    startTimer.setTooltip(new Tooltip("start test series iterating through each chart implementation"));
    startTimer.setMaxWidth(Double.MAX_VALUE);
    startTimer.setOnAction(evt -> {
        if (timer == null) {
            timer = new Thread() {
                @Override
                public void run() {
                    try {
                        for (int i = 0; i < nSamplesTest.length; i++) {
                            final int samples = nSamplesTest[i];
                            final int wait = i == 0 ? 2 * WAIT_PERIOD : WAIT_PERIOD;
                            LOGGER.atInfo().log("start test iteration for: " + samples + " samples");
                            if (samples > 10000) {
                                // pre-emptively abort test JavaFX Chart
                                // test case (too high memory/cpu
                                // consumptions crashes gc)
                                compute[0] = false;
                            }
                            final TestThread t1 = new TestThread(1, compute[0] ? samples : 1000, chart1,
                                    chartTestCase1, results1, updatePeriod, wait);
                            final TestThread t2 = new TestThread(2, compute[1] ? samples : 1000, chart2,
                                    chartTestCase2, results2, updatePeriod, wait);
                            final TestThread t3 = new TestThread(3, compute[2] ? samples : 1000, chart3,
                                    chartTestCase3, results3, updatePeriod, wait);

                            meter.resetAverages();
                            if (compute[0]) {
                                t1.start();
                                t1.join();
                            }
                            if (compute[1]) {
                                t2.start();
                                t2.join();
                            }
                            if (compute[2]) {
                                t3.start();
                                t3.join();
                            }

                            if (i <= 2) {
                                // ignore compute for first iteration
                                // (needed to optimise JIT compiler)
                                compute[0] = true;
                                compute[1] = true;
                                compute[2] = true;
                                results1.clearData();
                                results2.clearData();
                                results3.clearData();
                            }
                        }
                    } catch (final InterruptedException e) {
                        if (LOGGER.isErrorEnabled()) {
                            LOGGER.atError().setCause(e).log("InterruptedException");
                        }
                    }
                }
            };
            timer.start();
            LOGGER.atInfo().log("reset FPS averages");
            meter.resetAverages();
        } else {
            timer.interrupt();
            timer = null;
        }
    });
    return startTimer;
}