javafx.scene.control.ToolBar Java Examples

The following examples show how to use javafx.scene.control.ToolBar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WaterfallPerformanceSample.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
@Override
public void start(final Stage primaryStage) {
    ProcessingProfiler.setDebugState(false);
    ProcessingProfiler.setLoggerOutputState(false);

    VBox root = new VBox();
    final Scene scene = new Scene(root, 1150, 800);
    primaryStage.setTitle(getClass().getSimpleName());
    primaryStage.setScene(scene);
    primaryStage.show();
    primaryStage.setOnCloseRequest(this::closeDemo);

    ToolBar testVariableToolBar = getTestToolBar(scene);

    final XYChart chart = getChartPane(ContourType.HEATMAP);
    VBox.setVgrow(chart, Priority.SOMETIMES);

    ToolBar dataSetToolBar = getDataSetToolBar(chart);

    final ContourDataSetRenderer renderer = (ContourDataSetRenderer) chart.getRenderers().get(0);

    ToolBar contourToolBar = getContourToolBar(chart, renderer);

    root.getChildren().addAll(testVariableToolBar, chart, contourToolBar, dataSetToolBar);
}
 
Example #2
Source File: AnalyticResultsPane.java    From constellation with Apache License 2.0 6 votes vote down vote up
public AnalyticResultsPane(final AnalyticController analyticController) {

        // the analytic controller
        this.analyticController = analyticController;

        // the progress indicator pane
        this.progressIndicatorPane = new BorderPane();
        Platform.runLater(() -> {
            final ProgressIndicator progressIndicator = new ProgressIndicator();
            progressIndicator.setMaxSize(50, 50);
            progressIndicatorPane.setCenter(progressIndicator);
        });

        // the internal visualisation pane
        this.internalVisualisationPane = new TabPane();
        internalVisualisationPane.prefWidthProperty().bind(this.widthProperty());

        // the graph visualisation pane
        this.graphVisualisationPane = new ToolBar();
        graphVisualisationPane.prefWidthProperty().bind(this.widthProperty());

        // populate the analytic results pane
        this.getChildren().addAll(internalVisualisationPane, graphVisualisationPane);
    }
 
Example #3
Source File: PCGenFrame.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void initComponents()
{
	setLayout(new BorderLayout());

	JComponent root = getRootPane();
	root.setActionMap(actionMap);
	root.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, createInputMap(actionMap));

	characterTabs.add(new InfoGuidePane(this, uiContext));

	setJMenuBar(pcGenMenuBar);
	PCGenToolBar pcGenToolBar = new PCGenToolBar(this);
	ToolBar toolBar = pcGenToolBar.buildMenu();
	JFXPanel wrappedToolBar = GuiUtility.wrapParentAsJFXPanel(toolBar);

	add(wrappedToolBar, BorderLayout.NORTH);
	add(characterTabs, BorderLayout.CENTER);
	add(statusBar, BorderLayout.SOUTH);
	updateTitle();
	setIconImage(Icons.PCGenApp.getImageIcon().getImage());
}
 
Example #4
Source File: AlarmTreeView.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
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);
}
 
Example #5
Source File: ControlBarGUIPluginView.java    From AILibs with GNU Affero General Public License v3.0 6 votes vote down vote up
public ControlBarGUIPluginView(final ControlBarGUIPluginModel model) {
	super(model, new ToolBar());

	Platform.runLater(() -> {

		ToolBar topButtonToolBar = this.getNode();
		this.startButton = new Button("Play");
		this.startButton.setOnMouseClicked(event -> this.handleStartButtonClick());
		topButtonToolBar.getItems().add(this.startButton);

		Button pauseButton = new Button("Pause");
		pauseButton.setOnMouseClicked(event -> this.handlePauseButtonClick());
		topButtonToolBar.getItems().add(pauseButton);

		Button resetButton = new Button("Reset");
		resetButton.setOnMouseClicked(event -> this.handleResetButtonClick());
		topButtonToolBar.getItems().add(resetButton);

		topButtonToolBar.getItems().add(new Separator());
	});
}
 
Example #6
Source File: PCGenFrame.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void initComponents()
{
	setLayout(new BorderLayout());

	JComponent root = getRootPane();
	root.setActionMap(actionMap);
	root.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, createInputMap(actionMap));

	characterTabs.add(new InfoGuidePane(this, uiContext));

	setJMenuBar(pcGenMenuBar);
	PCGenToolBar pcGenToolBar = new PCGenToolBar(this);
	ToolBar toolBar = pcGenToolBar.buildMenu();
	JFXPanel wrappedToolBar = GuiUtility.wrapParentAsJFXPanel(toolBar);

	add(wrappedToolBar, BorderLayout.NORTH);
	add(characterTabs, BorderLayout.CENTER);
	add(statusBar, BorderLayout.SOUTH);
	updateTitle();
	setIconImage(Icons.PCGenApp.getImageIcon().getImage());
}
 
Example #7
Source File: ModalDialog.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
private ObservableList<Node> getChildren(Node node) {
    if (node instanceof ButtonBar) {
        return ((ButtonBar) node).getButtons();
    }
    if (node instanceof ToolBar) {
        return ((ToolBar) node).getItems();
    }
    if (node instanceof Pane) {
        return ((Pane) node).getChildren();
    }
    if (node instanceof TabPane) {
        ObservableList<Node> contents = FXCollections.observableArrayList();
        ObservableList<Tab> tabs = ((TabPane) node).getTabs();
        for (Tab tab : tabs) {
            contents.add(tab.getContent());
        }
        return contents;
    }
    return FXCollections.observableArrayList();
}
 
Example #8
Source File: MarathonCheckListStage.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
private void initCheckList() {
    ToolBar toolBar = new ToolBar();
    toolBar.getItems().add(new Text("Check Lists"));
    toolBar.setMinWidth(Region.USE_PREF_SIZE);
    leftPane.setTop(toolBar);
    checkListElements = checkListInfo.getCheckListElements();
    checkListView = new ListView<CheckListForm.CheckListElement>(checkListElements);
    checkListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        CheckListElement selectedItem = checkListView.getSelectionModel().getSelectedItem();
        if (selectedItem == null) {
            doneButton.setDisable(true);
            return;
        }
        Node checkListForm = getChecklistFormNode(selectedItem, Mode.DISPLAY);
        if (checkListForm == null) {
            doneButton.setDisable(true);
            return;
        }
        doneButton.setDisable(false);
        ScrollPane sp = new ScrollPane(checkListForm);
        sp.setFitToWidth(true);
        sp.setPadding(new Insets(0, 0, 0, 10));
        rightPane.setCenter(sp);
    });
    leftPane.setCenter(checkListView);
}
 
Example #9
Source File: FlyoutDemo.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    BorderPane pane = new BorderPane();
    
    ToolBar  toolBar = new ToolBar();
    
    Label fileLabel = new Label("File");
    
    flyout = createFlyout();
    
    // Could be TOP, LEFT, RIGHT too!
    flyout.setFlyoutSide(Flyout.Side.BOTTOM);
    
    toolBar.getItems().addAll(
        fileLabel,
        new Separator(),
        flyout
    );
    
    pane.setTop(toolBar);
    
    Scene scene = new Scene(pane, 600, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
Example #10
Source File: DataViewer.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
public DataViewer() {
    super();
    HBox.setHgrow(this, Priority.ALWAYS);
    VBox.setVgrow(this, Priority.ALWAYS);
    getStylesheets().add(getClass().getResource("DataViewer.css").toExternalForm());

    dataViewRoot.getSubDataViews().addListener(subDataViewChangeListener);
    dataViewRoot.activeSubViewProperty().addListener(activeSubDataViewChangeListener);
    userToolBarItems.addListener((ListChangeListener<Node>) change -> updateToolBar());
    showListStyleDataViews.addListener((ch, o, n) -> updateToolBar());
    selectedViewProperty().addListener((ch, o, n) -> updateToolBar());

    windowDecorationProperty().addListener((ch, o, n) -> updateWindowDecorations(dataViewRoot));
    detachableWindowProperty().addListener((ch, o, n) -> updateDetachableWindowProperty(dataViewRoot));
    windowDecorationVisible().addListener((ch, o, n) -> setWindowDecoration(Boolean.TRUE.equals(n) ? WindowDecoration.BAR : WindowDecoration.NONE));
    closeWindowButtonVisibleProperty().addListener(closeWindowButtonHandler);

    final Label spacer = new Label();
    HBox.setHgrow(spacer, Priority.ALWAYS);
    toolBar = new ToolBar(separator1, viewList, separator2, spacer);
    this.setCenter(dataViewRoot);
    requestLayout();
}
 
Example #11
Source File: FxDockPane.java    From FxDock with Apache License 2.0 6 votes vote down vote up
/** override to create your own toolbar, possibly with custom icons and buttons */
protected Node createToolBar(boolean tabMode)
{
	if(tabMode)
	{
		return null;
	}
	else
	{
		Button b = new Button("x");
		FX.style(b, FxDockStyles.TOOLBAR_CLOSE_BUTTON);
		closeAction.attach(b);
		
		ToolBar t = new ToolBar();
		FX.style(t, FxDockStyles.TOOLBAR);
		t.getItems().addAll(titleField, b);
		return t;
	}
}
 
Example #12
Source File: SimpleWebServer.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("Simple Web Server");
    BorderPane root = new BorderPane();
    TextArea area = new TextArea();
    root.setCenter(area);
    ToolBar bar = new ToolBar();
    Button openInBrowser = FXUIUtils.createButton("open-in-browser", "Open in External Browser", true);
    openInBrowser.setOnAction((event) -> {
        try {
            Desktop.getDesktop().browse(URI.create(webRoot));
        } catch (IOException e) {
            e.printStackTrace();
        }
    });
    Button changeRoot = FXUIUtils.createButton("fldr_closed", "Change Web Root", true);
    changeRoot.setOnAction((event) -> {
        DirectoryChooser chooser = new DirectoryChooser();
        File showDialog = chooser.showDialog(primaryStage);
        if (showDialog != null)
            server.setRoot(showDialog);
    });
    bar.getItems().add(openInBrowser);
    bar.getItems().add(changeRoot);
    root.setTop(bar);
    System.setOut(new PrintStream(new Console(area)));
    System.setErr(new PrintStream(new Console(area)));
    area.setEditable(false);
    primaryStage.setScene(new Scene(root));
    primaryStage.setOnShown((e) -> startServer(getParameters().getRaw()));
    primaryStage.show();
}
 
Example #13
Source File: ToolBarSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public ToolBarSample() {
    super(200,100);
    ToolBar toolbar = new ToolBar();
    toolbar.getItems().add(new Button("Home"));
    toolbar.getItems().add(new Button("Options"));
    toolbar.getItems().add(new Button("Help"));
    getChildren().add(toolbar);
}
 
Example #14
Source File: ToolbarHelper.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** Hack ill-sized toolbar buttons
 *
 *  <p>When toolbar is originally hidden and then later
 *  shown, it tends to be garbled, all icons in pile at left end,
 *  Manual fix is to hide and show again.
 *  Workaround is to force another layout a little later.
 */
public static void refreshHack(final ToolBar toolbar)
{
    if (toolbar.getParent() == null)
        return;
    for (Node node : toolbar.getItems())
    {
        if (! (node instanceof ButtonBase))
            continue;
        final ButtonBase button = (ButtonBase) node;
        final Node icon = button.getGraphic();
        if (icon == null)
            continue;
        // Re-set the icon to force new layout of button
        button.setGraphic(null);
        button.setGraphic(icon);
        if (button.getWidth() == 0  ||  button.getHeight() == 0)
        {   // If button has no size, yet, try again later
            ForkJoinPool.commonPool().submit(() ->
            {
                Thread.sleep(500);
                Platform.runLater(() -> refreshHack(toolbar));
                return null;
            });
            return;
        }
    }
    Platform.runLater(() -> toolbar.layout());
}
 
Example #15
Source File: TSpectrumSample.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
private VBox getBottomControls() {
    VBox root = new VBox();

    ToolBar toolBarBackground = new ToolBar();
    nIterations.valueProperty().addListener((ch, o, n) -> triggerDataSetUpdate());
    nIterations.setPrefWidth(70);
    cbxDirection.getSelectionModel().select(Direction.DECREASING);
    cbxDirection.setOnAction(evt -> triggerDataSetUpdate());
    cbxFilterOrder.getSelectionModel().select(FilterOrder.ORDER_6);
    cbxFilterOrder.setOnAction(evt -> triggerDataSetUpdate());
    cbxSmoothWindow.getSelectionModel().select(SmoothWindow.SMOOTHING_WIDTH15);
    cbxSmoothWindow.setOnAction(evt -> triggerDataSetUpdate());
    cbCompton.setOnAction(evt -> triggerDataSetUpdate());
    toolBarBackground.getItems().addAll(new Label("background:"), new Label("nIterations: "), nIterations, cbxDirection, cbxFilterOrder, cbxSmoothWindow, new Label("Compton:"),
            cbCompton);

    ToolBar toolBarMarkov = new ToolBar();
    spAverageMarkov.valueProperty().addListener((ch, o, n) -> triggerDataSetUpdate());
    spAverageMarkov.setPrefWidth(70);
    toolBarMarkov.getItems().addAll(new Label("Markov background:"), new Label("avg-width [bins: "), spAverageMarkov);

    ToolBar toolBarSearch = new ToolBar();
    spSigma.valueProperty().addListener((ch, o, n) -> triggerDataSetUpdate());
    spSigma.setPrefWidth(70);
    spSigma.setEditable(true);
    spThreshold.valueProperty().addListener((ch, o, n) -> triggerDataSetUpdate());
    spThreshold.setPrefWidth(100);
    spThreshold.setEditable(true);
    cbMarkov.setOnAction(evt -> triggerDataSetUpdate());
    cbBackground.setOnAction(evt -> triggerDataSetUpdate());
    spAverageSearch.valueProperty().addListener((ch, o, n) -> triggerDataSetUpdate());
    spAverageSearch.setPrefWidth(70);
    toolBarSearch.getItems().addAll(new Label("peak search: "), new Label("sigma [bins]: "), spSigma, new Label("threshold [%]: "), spThreshold, new Label("Markov?:"),
            cbMarkov, new Label("subtract bg: "), cbBackground, new Label("avg [bins]:"), spAverageSearch);

    root.getChildren().addAll(toolBarBackground, toolBarMarkov, toolBarSearch);
    return root;
}
 
Example #16
Source File: WaterfallPerformanceSample.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #17
Source File: TableViewPane.java    From constellation with Apache License 2.0 5 votes vote down vote up
public TableViewPane(final TableViewTopComponent parent) {
    this.parent = parent;
    this.columnIndex = new CopyOnWriteArrayList<>();
    this.elementIdToRowIndex = new HashMap<>();
    this.rowToElementIdIndex = new HashMap<>();
    this.lastChange = null;

    final ToolBar toolbar = initToolbar();
    setLeft(toolbar);

    this.table = new TableView<>();
    table.itemsProperty().addListener((v, o, n) -> table.refresh());
    table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    table.setPadding(new Insets(5));
    setCenter(table);

    // TODO: experiment with caching
    table.setCache(false);

    this.progress = new BorderPane();
    final ProgressIndicator progressIndicator = new ProgressIndicator();
    progressIndicator.setMaxSize(50, 50);
    progress.setCenter(progressIndicator);

    this.tableSelectionListener = (v, o, n) -> {
        if (parent.getCurrentState() != null && !parent.getCurrentState().isSelectedOnly()) {
            TableViewUtilities.copySelectionToGraph(table, rowToElementIdIndex,
                    parent.getCurrentState().getElementType(), parent.getCurrentGraph());
        }
    };
    this.selectedProperty = table.getSelectionModel().selectedItemProperty();
    selectedProperty.addListener(tableSelectionListener);
    
    this.scheduledExecutorService = Executors.newScheduledThreadPool(1);
}
 
Example #18
Source File: MountainRangeRendererSample.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
@Override
public void start(final Stage primaryStage) {
    primaryStage.setTitle(this.getClass().getSimpleName());

    final DefaultNumericAxis xAxis = new DefaultNumericAxis("X Position");
    final DefaultNumericAxis yAxis = new DefaultNumericAxis("Y Position");

    final XYChart chart = new XYChart(xAxis, yAxis);
    chart.setTitle("Test data");
    final MountainRangeRenderer mountainRangeRenderer = new MountainRangeRenderer();
    chart.getRenderers().set(0, mountainRangeRenderer);
    // mountainRangeRenderer.getDatasets().add(readImage());
    chart.getDatasets().setAll(createTestData(0.0));
    // DataSet3D additionalData = createTestData(1.0);
    // additionalData.setStyle("strokeColor=red");
    // chart.getDatasets().add(additionalData);

    chart.setLegendVisible(true);
    chart.getPlugins().add(new Zoomer());
    chart.getPlugins().add(new Panner());
    chart.getPlugins().add(new EditAxis());

    final Spinner<Double> mountainRangeOffset = new Spinner<>(0.0, 10.0, mountainRangeRenderer.getMountainRangeOffset(),
            0.1);
    mountainRangeRenderer.mountainRangeOffsetProperty().bind(mountainRangeOffset.valueProperty());
    mountainRangeOffset.valueProperty().addListener((ch, o, n) -> {
        if (n.equals(o)) {
            return;
        }
        chart.requestLayout();
    });

    final Scene scene = new Scene(
            new BorderPane(chart, new ToolBar(new Label(""), mountainRangeOffset), null, null, null), 1200, 800);
    primaryStage.setScene(scene);
    primaryStage.show();
    primaryStage.setOnCloseRequest(evt -> Platform.exit());
}
 
Example #19
Source File: ToolBarSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public ToolBarSample() {
    super(200,100);
    ToolBar toolbar = new ToolBar();
    toolbar.getItems().add(new Button("Home"));
    toolbar.getItems().add(new Button("Options"));
    toolbar.getItems().add(new Button("Help"));
    getChildren().add(toolbar);
}
 
Example #20
Source File: ToolbarHandler.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** Construct tool bar
 *  @param plot {@link RTPlot} to control from tool bar
 *  @param active React to mouse clicks?
 */
public ToolbarHandler(final RTPlot<XTYPE> plot, final boolean active)
{
    this.plot = plot;
    toolbar = new ToolBar();
    makeGUI(active);
}
 
Example #21
Source File: ImageToolbarHandler.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** Construct tool bar
 *  @param plot {@link RTImagePlot} to control from tool bar
 */
public ImageToolbarHandler(final RTImagePlot plot, final boolean active)
{
    this.plot = plot;
    toolbar = new ToolBar();
    makeGUI(active);
}
 
Example #22
Source File: DisplayRuntimeInstance.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
private Node createToolbar()
{
    zoom_action = new ZoomAction(this);
    navigate_backward = NavigationAction.createBackAction(this, navigation);
    navigate_forward = NavigationAction.createForewardAction(this, navigation);
    return new ToolBar(ToolbarHelper.createSpring(),
                       zoom_action,
                       navigate_backward,
                       navigate_forward
                       );
}
 
Example #23
Source File: MarkdownEditorControl.java    From Lipi with MIT License 5 votes vote down vote up
private void customize() {
    //TODO Customize HTMLEDITOR later.

    ToolBar topBar = (ToolBar) this.lookup(".top-toolbar");
    ToolBar bottomBar = (ToolBar) this.lookup(".bottom-toolbar");

    setupBanglaModeToggle();
    setupImageInsertButton();

    topBar.getItems().add(banglaModeToggle);
    bottomBar.getItems().add(imageInsertButton);

    setMdText("Hello, this is where you write :)");
}
 
Example #24
Source File: JFXToolBar.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
public JFXToolBar(JFXContainer<? extends Region> container, Orientation orientation) {
	super(new ToolBar(), container);
	
	this.layout = new UITableLayout(0f);
	this.packedContentSize = new UISize();
	this.toolItems = new ArrayList<JFXNode<? extends Node>>();
	
	this.getControl().setOrientation(orientation);
}
 
Example #25
Source File: TestDiagramTabToolBar.java    From JetUML with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private SelectableToolButton getButtonAtPosition(int pPosition)
{
	try
	{
		final List<Node> nodes = (List<Node>) ToolBar.class.getDeclaredMethod("getItems").invoke(aToolbar);
		return (SelectableToolButton) nodes.get(pPosition);
	}
	catch( ReflectiveOperationException exception )
	{
		exception.printStackTrace();
		fail();
	}
	return null;
}
 
Example #26
Source File: SearchControls.java    From VocabHunter with Apache License 2.0 5 votes vote down vote up
public SearchControls(
    final ToolBar barSearch, final CustomTextField fieldSearch, final Label labelMatches,
    final Button buttonCloseSearch, final Button buttonSearchUp, final Button buttonSearchDown) {
    this.barSearch = barSearch;
    this.fieldSearch = fieldSearch;
    this.labelMatches = labelMatches;
    this.buttonCloseSearch = buttonCloseSearch;
    this.buttonSearchUp = buttonSearchUp;
    this.buttonSearchDown = buttonSearchDown;
}
 
Example #27
Source File: GitFxToolBarTest.java    From GitFx with Apache License 2.0 5 votes vote down vote up
@Test
public void  launchApplication() throws Exception {
    WaitForAsyncUtils.waitForFxEvents();
    Button gitinit = (Button)scene.lookup("#gitinit");
    Assert.assertEquals("\uf04b",gitinit.getText());
    Button gitclone = (Button)scene.lookup("#gitclone");
    Assert.assertEquals("\uF0C5", gitclone.getText());
    ToolBar toolbar = (ToolBar)scene.lookup("#gitToolBar");
    AnchorPane anchor = (AnchorPane)toolbar.getParent();
    Double anchorPaneConstraint = new Double(0.0);
    Assert.assertEquals("Left Anchor Test",anchorPaneConstraint, anchor.getLeftAnchor(toolbar));
    Assert.assertEquals("Right Anchor Test",anchorPaneConstraint,anchor.getRightAnchor(toolbar));
    Assert.assertEquals("Top Anchor Test", anchorPaneConstraint, anchor.getTopAnchor(toolbar));
}
 
Example #28
Source File: GCApp.java    From FXTutorials with MIT License 5 votes vote down vote up
private ToolBar makeToolbar() {
    Button btnNewObject = new Button("New Object");
    btnNewObject.setOnAction(e -> newObject());

    Button btnRandomKill = new Button("Random Kill");
    btnRandomKill.setOnAction(e -> randomKill());

    Button btnMinorGC = new Button("Minor GC");
    btnMinorGC.setOnAction(e -> minorGC());

    Button btnMajorGC = new Button("Major GC");
    btnMajorGC.setOnAction(e -> majorGC());

    return new ToolBar(btnNewObject, btnRandomKill, btnMinorGC, btnMajorGC);
}
 
Example #29
Source File: RubikFX.java    From RubikFX with GNU General Public License v3.0 5 votes vote down vote up
private void rotateFace(final String btRot){
    pane.getChildren().stream()
        .filter(withToolbars())
        .forEach(tb->{
            ((ToolBar)tb).getItems().stream()
                .filter(withMoveButtons().and(withButtonTextName(btRot)))
                .findFirst().ifPresent(n->rubik.isHoveredOnClick().set(((Button)n).isHover()));
        });
    rubik.rotateFace(btRot);
}
 
Example #30
Source File: SamplePage.java    From javamoney-examples with Apache License 2.0 5 votes vote down vote up
public void initView() {
	try {
		// check if 3d sample and on supported platform
		loadCode();
		// create code view
		WebView webView = getWebView();
		webView.setPrefWidth(300);
		engine.loadContent(htmlCode);
		ToolBar codeToolBar = new ToolBar();
		codeToolBar.setId("code-tool-bar");
		Button copyCodeButton = new Button("Copy Source");
		copyCodeButton.setOnAction(new EventHandler<ActionEvent>() {
			public void handle(ActionEvent actionEvent) {
				Map<DataFormat, Object> clipboardContent = new HashMap<DataFormat, Object>();
				clipboardContent.put(DataFormat.PLAIN_TEXT, rawCode);
				clipboardContent.put(DataFormat.HTML, htmlCode);
				Clipboard.getSystemClipboard().setContent(clipboardContent);
			}
		});
		codeToolBar.getItems().addAll(copyCodeButton);
		setTop(codeToolBar);
		setCenter(webView);
	} catch (Exception e) {
		e.printStackTrace();
		setCenter(new Text("Failed to create sample because of ["
				+ e.getMessage() + "]"));
	}
}