org.controlsfx.glyphfont.Glyph Java Examples
The following examples show how to use
org.controlsfx.glyphfont.Glyph.
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: ButtonCell.java From mzmine3 with GNU General Public License v2.0 | 6 votes |
public ButtonCell(TableColumn<T, Boolean> column, Glyph onGraphic, Glyph offGraphic) { button = new ToggleButton(); button.setGraphic(onGraphic); button.setSelected(true); button.setOnMouseClicked(event -> { final TableView<T> tableView = getTableView(); tableView.getSelectionModel().select(getTableRow().getIndex()); tableView.edit(tableView.getSelectionModel().getSelectedIndex(), column); if (button.isSelected()) { commitEdit(true); button.setGraphic(onGraphic); } else { commitEdit(false); button.setGraphic(offGraphic); } }); }
Example #2
Source File: ButtonCell.java From mzmine2 with GNU General Public License v2.0 | 6 votes |
public ButtonCell(TableColumn<T, Boolean> column, Glyph onGraphic, Glyph offGraphic) { button = new ToggleButton(); button.setGraphic(onGraphic); button.setSelected(true); button.setOnMouseClicked(event -> { final TableView<T> tableView = getTableView(); tableView.getSelectionModel().select(getTableRow().getIndex()); tableView.edit(tableView.getSelectionModel().getSelectedIndex(), column); if (button.isSelected()) { commitEdit(true); button.setGraphic(onGraphic); } else { commitEdit(false); button.setGraphic(offGraphic); } }); }
Example #3
Source File: EditAxis.java From chart-fx with Apache License 2.0 | 6 votes |
private Pane getMinMaxButtons(final Axis axis, final boolean isHorizontal, final boolean isMin) { final Button incMaxButton = new Button("", new Glyph(EditAxis.FONT_AWESOME, "\uf077")); incMaxButton.setMaxWidth(Double.MAX_VALUE); VBox.setVgrow(incMaxButton, Priority.ALWAYS); HBox.setHgrow(incMaxButton, Priority.ALWAYS); incMaxButton.setOnAction(evt -> { axis.setAutoRanging(false); changeAxisRangeLimit(axis, isHorizontal ? isMin : !isMin, true); }); final Button decMaxButton = new Button("", new Glyph(EditAxis.FONT_AWESOME, "\uf078")); decMaxButton.setMaxWidth(Double.MAX_VALUE); VBox.setVgrow(decMaxButton, Priority.ALWAYS); HBox.setHgrow(decMaxButton, Priority.ALWAYS); decMaxButton.setOnAction(evt -> { axis.setAutoRanging(false); changeAxisRangeLimit(axis, isHorizontal ? isMin : !isMin, false); }); final Pane box = isHorizontal ? new VBox() : new HBox(); box.getChildren().addAll(incMaxButton, decMaxButton); return box; }
Example #4
Source File: EditAxis.java From chart-fx with Apache License 2.0 | 6 votes |
private Pane getRangeChangeButtons(final Axis axis, final boolean isHorizontal) { final Button incMaxButton = new Button("", new Glyph(EditAxis.FONT_AWESOME, "expand")); incMaxButton.setMaxWidth(Double.MAX_VALUE); VBox.setVgrow(incMaxButton, Priority.NEVER); HBox.setHgrow(incMaxButton, Priority.NEVER); incMaxButton.setOnAction(evt -> { axis.setAutoRanging(false); changeAxisRange(axis, true); }); final Button decMaxButton = new Button("", new Glyph(EditAxis.FONT_AWESOME, "compress")); decMaxButton.setMaxWidth(Double.MAX_VALUE); VBox.setVgrow(decMaxButton, Priority.NEVER); HBox.setHgrow(decMaxButton, Priority.NEVER); decMaxButton.setOnAction(evt -> { axis.setAutoRanging(false); changeAxisRange(axis, false); }); final Pane boxMax = isHorizontal ? new VBox() : new HBox(); boxMax.getChildren().addAll(incMaxButton, decMaxButton); return boxMax; }
Example #5
Source File: IconUtils.java From PeerWasp with MIT License | 5 votes |
/** * Returns an error icon (glyph created using font awesome). * * @return graphic node */ public static Node createErrorIcon() { GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome"); Glyph graphic = fontAwesome.create(FontAwesome.Glyph.EXCLAMATION_TRIANGLE); graphic.setFontSize(20.0); graphic.setColor(Color.RED); return graphic; }
Example #6
Source File: Archivo.java From archivo with GNU General Public License v3.0 | 5 votes |
public Glyph getGlyph(Enum<?> glyphName) { if (symbolFont == null) { logger.warn("No symbol font available"); return null; } return symbolFont.create(glyphName); }
Example #7
Source File: UITools.java From gluon-samples with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static Node getRefIcon(GitRef ref) { if (ref instanceof GitTag) { return getIcon(Octicons.Glyph.TAG); } else if (ref instanceof GitBranch) { return getIcon(Octicons.Glyph.BRANCH); } else { return null; } }
Example #8
Source File: NavigationView.java From PreferencesFX with Apache License 2.0 | 5 votes |
/** * Initializes the TextField and sets the search icon. */ private void setupTextField() { searchFld = new CustomTextField(); GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome"); Glyph glyph = fontAwesome.create(FontAwesome.Glyph.SEARCH).color(Color.GRAY); glyph.setPadding(new Insets(0, 3, 0, 5)); searchFld.setLeft(glyph); }
Example #9
Source File: EditDataSet.java From chart-fx with Apache License 2.0 | 5 votes |
@Override protected void updateItem(ShiftConstraint shiftConstraint, boolean empty) { super.updateItem(shiftConstraint, empty); if (shiftConstraint == null || empty) { setGraphic(null); return; } Glyph result; Tooltip tooltip = new Tooltip(); switch (shiftConstraint) { case SHIFTX: result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.ARROWS_H).size(FONT_SIZE_COMBO); tooltip.setText("Allow to modify the x value of the points"); setText("shift x"); break; case SHIFTXY: result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.ARROWS).size(FONT_SIZE_COMBO); tooltip.setText("Allow to modify the the points freely"); setText("shift xy"); break; case SHIFTY: result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.ARROWS_V).size(FONT_SIZE_COMBO); tooltip.setText("Allow to modify the x value of the points"); setText("shift y"); break; default: result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.QUESTION_CIRCLE).size(FONT_SIZE_COMBO); setText("-"); } result.setTextFill(Color.DARKBLUE); result.setPadding(Insets.EMPTY); setGraphic(result); }
Example #10
Source File: Zoomer.java From chart-fx with Apache License 2.0 | 5 votes |
public HBox getZoomInteractorBar() { final Separator separator = new Separator(); separator.setOrientation(Orientation.VERTICAL); final HBox buttonBar = new HBox(); buttonBar.setPadding(new Insets(1, 1, 1, 1)); final Button zoomOut = new Button(null, new Glyph(FONT_AWESOME, "\uf0b2").size(FONT_SIZE)); zoomOut.setPadding(new Insets(3, 3, 3, 3)); zoomOut.setTooltip(new Tooltip("zooms to origin and enables auto-ranging")); final Button zoomModeXY = new Button(null, new Glyph(FONT_AWESOME, "\uf047").size(FONT_SIZE)); zoomModeXY.setPadding(new Insets(3, 3, 3, 3)); zoomModeXY.setTooltip(new Tooltip("set zoom-mode to X & Y range (N.B. disables auto-ranging)")); final Button zoomModeX = new Button(null, new Glyph(FONT_AWESOME, "\uf07e").size(FONT_SIZE)); zoomModeX.setPadding(new Insets(3, 3, 3, 3)); zoomModeX.setTooltip(new Tooltip("set zoom-mode to X range (N.B. disables auto-ranging)")); final Button zoomModeY = new Button(null, new Glyph(FONT_AWESOME, "\uf07d").size(FONT_SIZE)); zoomModeY.setPadding(new Insets(3, 3, 3, 3)); zoomModeY.setTooltip(new Tooltip("set zoom-mode to Y range (N.B. disables auto-ranging)")); zoomOut.setOnAction(evt -> { zoomOrigin(); for (final Axis axis : getChart().getAxes()) { axis.setAutoRanging(true); } }); zoomModeXY.setOnAction(evt -> setAxisMode(AxisMode.XY)); zoomModeX.setOnAction(evt -> setAxisMode(AxisMode.X)); zoomModeY.setOnAction(evt -> setAxisMode(AxisMode.Y)); buttonBar.getChildren().addAll(separator, zoomOut, zoomModeXY, zoomModeX, zoomModeY); return buttonBar; }
Example #11
Source File: GlyphFactory.java From chart-fx with Apache License 2.0 | 5 votes |
/** * Creates a glyph for given identifier * * @param icon one of the font code available in {@link FontAwesome} Glyph enum. * @return created glyph */ public static synchronized Glyph create(final FontAwesome.Glyph icon) { if (GlyphFactory.fontAwesome == null) { try (InputStream is = GlyphFactory.class.getResourceAsStream("FONT_AWESOME-webfont")) { GlyphFactory.fontAwesome = new FontAwesome(is); GlyphFontRegistry.register(GlyphFactory.fontAwesome); } catch (final IOException e) { e.printStackTrace(); } } return GlyphFactory.fontAwesome.create(icon); }
Example #12
Source File: TransposedDataSetSample.java From chart-fx with Apache License 2.0 | 4 votes |
@Override public void start(final Stage primaryStage) { // init default 2D Chart final XYChart chart1 = getDefaultChart(); final ErrorDataSetRenderer renderer = (ErrorDataSetRenderer) chart1.getRenderers().get(0); renderer.setAssumeSortedData(false); // necessary to suppress sorted-DataSet-only optimisations // alternate DataSet: // final CosineFunction dataSet1 = new CosineFunction("test cosine", N_SAMPLES); final DataSet dataSet1 = test8Function(0, 4, -1, 3, (Math.PI / N_SAMPLES) * 2 * N_TURNS, 0.2, N_SAMPLES); final TransposedDataSet transposedDataSet1 = TransposedDataSet.transpose(dataSet1, false); renderer.getDatasets().add(transposedDataSet1); // init default 3D Chart with HeatMapRenderer final XYChart chart2 = getDefaultChart(); final ContourDataSetRenderer contourRenderer = new ContourDataSetRenderer(); chart2.getRenderers().setAll(contourRenderer); final DataSet dataSet2 = createTestData(); dataSet2.getAxisDescription(DIM_X).set("x-axis", "x-unit"); dataSet2.getAxisDescription(DIM_Y).set("y-axis", "y-unit"); final TransposedDataSet transposedDataSet2 = TransposedDataSet.transpose(dataSet2, false); contourRenderer.getDatasets().add(transposedDataSet2); // init ToolBar items to illustrate the two different methods to flip the DataSet final CheckBox cbTransposed = new CheckBox("flip data set"); final TextField textPermutation = new TextField("0,1,2"); textPermutation.setPrefWidth(100); cbTransposed.setTooltip(new Tooltip("press to transpose DataSet")); cbTransposed.setGraphic(new Glyph(FONT_AWESOME, FONT_SYMBOL_TRANSPOSE).size(FONT_SIZE)); final Button bApplyPermutation = new Button(null, new Glyph(FONT_AWESOME, FONT_SYMBOL_CHECK).size(FONT_SIZE)); bApplyPermutation.setTooltip(new Tooltip("press to apply permutation")); // flipping method #1: via 'setTransposed(boolean)' - flips only first two axes cbTransposed.setOnAction(evt -> { if (LOGGER.isInfoEnabled()) { LOGGER.atInfo().addArgument(cbTransposed.isSelected()).log("set transpose state to '{}'"); } transposedDataSet1.setTransposed(cbTransposed.isSelected()); transposedDataSet2.setTransposed(cbTransposed.isSelected()); textPermutation.setText(Arrays.stream(transposedDataSet2.getPermutation()).boxed().map(String::valueOf).collect(Collectors.joining(","))); }); // flipping method #2: via 'setPermutation(int[])' - flips arbitrary combination of axes final Runnable permutationAction = () -> { final int[] parsedInt1 = Arrays.asList(textPermutation.getText().split(",")) .subList(0, transposedDataSet1.getDimension()) .stream() .map(String::trim) .mapToInt(Integer::parseInt) .toArray(); final int[] parsedInt2 = Arrays.asList(textPermutation.getText().split(",")) .subList(0, transposedDataSet2.getDimension()) .stream() .map(String::trim) .mapToInt(Integer::parseInt) .toArray(); transposedDataSet1.setPermutation(parsedInt1); transposedDataSet2.setPermutation(parsedInt2); }; textPermutation.setOnAction(evt -> permutationAction.run()); bApplyPermutation.setOnAction(evt -> permutationAction.run()); // the usual JavaFX Application boiler-plate code final ToolBar toolBar = new ToolBar(new Label("method #1 - transpose: "), cbTransposed, new Separator(), new Label("method #2 - permutation: "), textPermutation, bApplyPermutation); final HBox hBox = new HBox(chart1, chart2); VBox.setVgrow(hBox, Priority.ALWAYS); final Scene scene = new Scene(new VBox(toolBar, hBox), 800, 600); primaryStage.setTitle(getClass().getSimpleName()); primaryStage.setScene(scene); primaryStage.show(); primaryStage.setOnCloseRequest(evt -> Platform.exit()); }
Example #13
Source File: SnowFlakeSample.java From chart-fx with Apache License 2.0 | 4 votes |
@Override public void start(final Stage primaryStage) { final XYChart chart1 = getChristmasChart(false); final XYChart chart2 = getChristmasChart(true); final CheckBox cbTransposed = new CheckBox("flip tree"); cbTransposed.setTooltip(new Tooltip("press to flip tree")); cbTransposed.setGraphic(new Glyph(FONT_AWESOME, FONT_SYMBOL_TRANSPOSE).size(FONT_SIZE)); cbTransposed.selectedProperty().bindBidirectional(flipProperty); final CheckBox cbSnow = new CheckBox("snow"); cbSnow.setTooltip(new Tooltip("press to switch on/off snow")); cbSnow.setGraphic(new Glyph(FONT_AWESOME, FONT_SYMBOL_SNOW).size(FONT_SIZE)); cbSnow.selectedProperty().bindBidirectional(snowProperty); Slider nFlakeSpeed = new Slider(0.0, 2, velocityProperty.get()); nFlakeSpeed.setBlockIncrement(0.1); nFlakeSpeed.setMajorTickUnit(0.1); velocityProperty.bind(nFlakeSpeed.valueProperty()); Spinner<Integer> nSnowFlakes = new Spinner<>(10, 1000, 200, numberOfFlakesProperty.get()); numberOfFlakesProperty.bind(nSnowFlakes.valueProperty()); Spinner<Double> meanFlakeSize = new Spinner<>(0.1, 20.0, meanSizeProperty.get(), 0.1); meanSizeProperty.bind(meanFlakeSize.valueProperty()); Spinner<Double> rmsFlakeSize = new Spinner<>(0.1, 20.0, rmsSizeProperty.get(), 0.1); rmsSizeProperty.bind(rmsFlakeSize.valueProperty()); final ToolBar toolBar = new ToolBar(cbTransposed, cbSnow, new Label("speed:"), nFlakeSpeed, // new Label("n-flakes:"), nSnowFlakes, new Label("mean-size:"), meanFlakeSize, // new Label("rms-size:"), rmsFlakeSize); final HBox hBox = new HBox(chart1, chart2); VBox.setVgrow(hBox, Priority.ALWAYS); final Scene scene = new Scene(new VBox(toolBar, hBox), WIDTH, HEIGHT); primaryStage.setTitle(SnowFlakeSample.class.getSimpleName()); primaryStage.setOnCloseRequest(evt -> Platform.exit()); primaryStage.setScene(scene); primaryStage.show(); if (LOGGER.isDebugEnabled()) { LOGGER.atDebug().log("scene initialised"); } }
Example #14
Source File: RepoManagerView.java From gluon-samples with BSD 3-Clause "New" or "Revised" License | 4 votes |
private Glyph getGitIcon() { return GlyphFontRegistry.font("FontAwesome").create(FontAwesome.Glyph.GIT_SQUARE); }
Example #15
Source File: UITools.java From gluon-samples with BSD 3-Clause "New" or "Revised" License | 4 votes |
public static Node getIcon(Octicons.Glyph iconType ) { Glyph icon = GlyphFontRegistry.font(Octicons.NAME).create(iconType).size(14); icon.getStyleClass().add("ref-icon"); return icon; }
Example #16
Source File: Screenshot.java From chart-fx with Apache License 2.0 | 4 votes |
/** * @return A node with screenshot buttons which can be inserted into the toolbar */ public HBox getScreenshotInteractorBar() { final HBox buttonBar = new HBox(); final Separator separator = new Separator(); separator.setOrientation(Orientation.VERTICAL); SplitMenuButton button = new SplitMenuButton(); button.setGraphic(new HBox(0.1, new Glyph(FONT_AWESOME, FontAwesome.Glyph.CAMERA).size(FONT_SIZE), new Glyph(FONT_AWESOME, FontAwesome.Glyph.CLIPBOARD).size(FONT_SIZE - 8.0))); button.setOnAction(evt -> { if (toFile) { screenshotToFile(true); } else { screenshotToClipboard(); } }); MenuItem toClipMenu = new MenuItem("Screenshot to clipboard", new Glyph(FONT_AWESOME, FontAwesome.Glyph.CLIPBOARD)); toClipMenu.setOnAction(evt -> { toFile = false; button.setGraphic(new HBox(0.1, new Glyph(FONT_AWESOME, FontAwesome.Glyph.CAMERA).size(FONT_SIZE), new Glyph(FONT_AWESOME, FontAwesome.Glyph.CLIPBOARD).size(FONT_SIZE - 8.8))); button.setTooltip(new Tooltip("Copy screenshot of plot to Clipboard")); screenshotToClipboard(); }); MenuItem toFileMenu = new MenuItem("Screenshot to file", new Glyph(FONT_AWESOME, FontAwesome.Glyph.FILE)); toFileMenu.setOnAction(evt -> { toFile = true; button.setGraphic(new HBox(0.1, new Glyph(FONT_AWESOME, FontAwesome.Glyph.CAMERA).size(FONT_SIZE), new Glyph(FONT_AWESOME, FontAwesome.Glyph.FILE).size(FONT_SIZE - 8.0))); button.setTooltip(new Tooltip("Save plot as image")); screenshotToFile(true); }); MenuItem settingsMenu = new MenuItem("Screenshot settings", new Glyph(FONT_AWESOME, FontAwesome.Glyph.WRENCH)); settingsMenu.setOnAction(evt -> { ScreenshotDialog alert = new ScreenshotDialog(); alert.showAndWait() // .filter(response -> response == ButtonType.OK) // .ifPresent(response -> { directory.set(alert.getDirectory()); pattern.set(alert.getPattern()); }); }); button.getItems().addAll(toClipMenu, toFileMenu, new SeparatorMenuItem(), settingsMenu); buttonBar.getChildren().addAll(separator, button); return buttonBar; }
Example #17
Source File: Fx3DStageController.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public void initialize() { rotateX.setPivotZ(SIZE / 2); rotateX.setPivotX(SIZE / 2); rotateY.setPivotZ(SIZE / 2); rotateY.setPivotX(SIZE / 2); plot.getTransforms().addAll(rotateX, rotateY); translateY.setY(250); translateX.setX(170); finalNode.getTransforms().addAll(translateX, translateY); finalNode.getChildren().add(plot); HBox.setHgrow(leftRegion, Priority.ALWAYS); HBox.setHgrow(rightRegion, Priority.ALWAYS); plot.getChildren().add(axes); colorCol.setCellFactory( column -> new ColorTableCell<Fx3DAbstractDataset>(column)); double minValue = 0; double maxValue = 1; opacityCol.setCellFactory(column -> new SliderCell<Fx3DAbstractDataset>( column, minValue, maxValue)); visibilityCol.setCellFactory( column -> new ButtonCell<Fx3DAbstractDataset>(column, new Glyph("FontAwesome", "EYE"), new Glyph("FontAwesome", "EYE_SLASH"))); axesBtn.setSelected(true); lightsBtn.setSelected(true); addLights(); rotateAnimationTimeline = new Timeline( new KeyFrame(Duration.seconds(0), new KeyValue(yRotate.angleProperty(), 360)), new KeyFrame(Duration.seconds(50), new KeyValue(yRotate.angleProperty(), 0))); rotateAnimationTimeline.setCycleCount(Timeline.INDEFINITE); tableView.setItems(visualizedMeshPlots); plot.getChildren().add(meshViews); plot.getChildren().add(lights); allDataFiles = Arrays.asList(MZmineCore.getProjectManager() .getCurrentProject().getDataFiles()); allPeakLists = MZmineCore.getProjectManager().getCurrentProject() .getPeakLists(); scene3D.widthProperty().bind(root.widthProperty()); scene3D.heightProperty().bind(root.heightProperty()); scene3D.setCamera(camera); scene3D.setPickOnBounds(true); }
Example #18
Source File: TilingPane.java From chart-fx with Apache License 2.0 | 4 votes |
Layout(final String name, final Glyph glyph) { this.name = name; this.glyph = glyph; }
Example #19
Source File: Fx3DStageController.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public void initialize() { // Use main CSS scene.getStylesheets() .addAll(MZmineCore.getDesktop().getMainWindow().getScene().getStylesheets()); rotateX.setPivotZ(SIZE / 2); rotateX.setPivotX(SIZE / 2); rotateY.setPivotZ(SIZE / 2); rotateY.setPivotX(SIZE / 2); plot.getTransforms().addAll(rotateX, rotateY); translateY.setY(250); translateX.setX(170); finalNode.getTransforms().addAll(translateX, translateY); finalNode.getChildren().add(plot); HBox.setHgrow(leftRegion, Priority.ALWAYS); HBox.setHgrow(rightRegion, Priority.ALWAYS); plot.getChildren().add(axes); colorCol.setCellFactory(column -> new ColorTableCell<Fx3DAbstractDataset>(column)); double minValue = 0; double maxValue = 1; opacityCol .setCellFactory(column -> new SliderCell<Fx3DAbstractDataset>(column, minValue, maxValue)); visibilityCol.setCellFactory(column -> new ButtonCell<Fx3DAbstractDataset>(column, new Glyph("FontAwesome", "EYE"), new Glyph("FontAwesome", "EYE_SLASH"))); axesBtn.setSelected(true); lightsBtn.setSelected(true); addLights(); rotateAnimationTimeline = new Timeline(new KeyFrame(Duration.seconds(0), new KeyValue(yRotate.angleProperty(), 360)), new KeyFrame(Duration.seconds(50), new KeyValue(yRotate.angleProperty(), 0))); rotateAnimationTimeline.setCycleCount(Timeline.INDEFINITE); tableView.setItems(visualizedMeshPlots); plot.getChildren().add(meshViews); plot.getChildren().add(lights); allDataFiles = Arrays.asList(MZmineCore.getProjectManager().getCurrentProject().getDataFiles()); allPeakLists = MZmineCore.getProjectManager().getCurrentProject().getPeakLists(); scene3D.widthProperty().bind(root.widthProperty()); scene3D.heightProperty().bind(root.heightProperty()); scene3D.setCamera(camera); scene3D.setPickOnBounds(true); // Add the Windows menu WindowsMenu.addWindowsMenu(scene); }