Java Code Examples for javafx.scene.control.Label#setTextFill()
The following examples show how to use
javafx.scene.control.Label#setTextFill() .
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: JaceUIController.java From jace with GNU General Public License v2.0 | 8 votes |
public void displayNotification(String message) { Label oldNotification = currentNotification; Label notification = new Label(message); currentNotification = notification; notification.setEffect(new DropShadow(2.0, Color.BLACK)); notification.setTextFill(Color.WHITE); notification.setBackground(new Background(new BackgroundFill(Color.rgb(0, 0, 80, 0.7), new CornerRadii(5.0), new Insets(-5.0)))); Application.invokeLater(() -> { stackPane.getChildren().remove(oldNotification); stackPane.getChildren().add(notification); }); notificationExecutor.schedule(() -> { Application.invokeLater(() -> { stackPane.getChildren().remove(notification); }); }, 4, TimeUnit.SECONDS); }
Example 2
Source File: MetacheatUI.java From jace with GNU General Public License v2.0 | 6 votes |
private Watch addWatch(int addr) { Watch watch = new Watch(addr, this); watch.setPadding(new Insets(5)); watch.setOpaqueInsets(new Insets(10)); Label addCheat = new Label("Cheat >>"); addCheat.setOnMouseClicked((mouseEvent) -> { addCheat(addr, watch.getValue()); }); addCheat.setTextFill(Color.WHITE); watch.getChildren().add(addCheat); Label close = new Label("Close X"); close.setOnMouseClicked((mouseEvent) -> { watch.disconnect(); watchesPane.getChildren().remove(watch); }); close.setTextFill(Color.WHITE); watch.getChildren().add(close); watchesPane.getChildren().add(watch); return watch; }
Example 3
Source File: ColorPickerApp.java From oim-fx with MIT License | 6 votes |
public Parent createContent() { final ColorPicker colorPicker = new ColorPicker(Color.GREEN); final Label coloredText = new Label("Colors"); Font font = new Font(53); coloredText.setFont(font); final Button coloredButton = new Button("Colored Control"); Color c = colorPicker.getValue(); coloredText.setTextFill(c); coloredButton.setStyle(createRGBString(c)); colorPicker.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { Color newColor = colorPicker.getValue(); coloredText.setTextFill(newColor); coloredButton.setStyle(createRGBString(newColor)); } }); VBox outerVBox = new VBox(coloredText, coloredButton, colorPicker); outerVBox.setAlignment(Pos.CENTER); outerVBox.setSpacing(20); outerVBox.setMaxSize(VBox.USE_PREF_SIZE, VBox.USE_PREF_SIZE); return outerVBox; }
Example 4
Source File: LineChartSample.java From StockPrediction with Apache License 2.0 | 6 votes |
private Label createDataThresholdLabel(int priorValue, int value) { final Label label = new Label(value + ""); label.getStyleClass().addAll("default-color0", "chart-line-symbol", "chart-series-line"); label.setStyle("-fx-font-size: 20; -fx-font-weight: bold;"); if (priorValue == 0) { label.setTextFill(Color.DARKGRAY); } else if (value > priorValue) { label.setTextFill(Color.FORESTGREEN); } else { label.setTextFill(Color.FIREBRICK); } label.setMinSize(Label.USE_PREF_SIZE, Label.USE_PREF_SIZE); return label; }
Example 5
Source File: LedTileSkin.java From tilesfx with Apache License 2.0 | 6 votes |
@Override protected void initGraphics() { super.initGraphics(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); description = new Label(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); description.setWrapText(true); description.setTextFill(tile.getTextColor()); Helper.enableNode(description, !tile.getDescription().isEmpty()); ledBorder = new Circle(); led = new Circle(); hightlight = new Circle(); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0); led.setEffect(innerShadow); getPane().getChildren().addAll(titleText, text, description, ledBorder, led, hightlight); }
Example 6
Source File: AlarmAreaView.java From phoebus with Eclipse Public License 1.0 | 6 votes |
private void updateItem(final String item_name) { final Label view_item = itemViewMap.get(item_name); if (view_item == null) { logger.log(Level.WARNING, "Cannot update unknown alarm area item " + item_name); return; } final SeverityLevel severity = areaFilter.getSeverity(item_name); final Color color = AlarmUI.getColor(severity); view_item.setBackground(new Background(new BackgroundFill(color, radii, Insets.EMPTY))); if (color.getBrightness() >= 0.5) view_item.setTextFill(Color.BLACK); else view_item.setTextFill(Color.WHITE); }
Example 7
Source File: TextSymbolRepresentation.java From phoebus with Eclipse Public License 1.0 | 6 votes |
@Override protected Label createJFXNode ( ) throws Exception { Label symbol = new Label(); symbol.setAlignment(JFXUtil.computePos(model_widget.propHorizontalAlignment().getValue(), model_widget.propVerticalAlignment().getValue())); symbol.setBackground(model_widget.propTransparent().getValue() ? null : new Background(new BackgroundFill(JFXUtil.convert(model_widget.propBackgroundColor().getValue()), CornerRadii.EMPTY, Insets.EMPTY)) ); symbol.setFont(JFXUtil.convert(model_widget.propFont().getValue())); symbol.setTextFill(JFXUtil.convert(model_widget.propForegroundColor().getValue())); symbol.setText("\u263A"); enabled = model_widget.propEnabled().getValue(); Styles.update(symbol, Styles.NOT_ENABLED, !enabled); return symbol; }
Example 8
Source File: CharacterTileSkin.java From OEE-Designer with MIT License | 6 votes |
@Override protected void initGraphics() { super.initGraphics(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); description = new Label(tile.getDescription()); description.setAlignment(Pos.CENTER); description.setTextAlignment(TextAlignment.CENTER); description.setWrapText(true); description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS); description.setTextFill(tile.getTextColor()); description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.795); Helper.enableNode(description, tile.isTextVisible()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); getPane().getChildren().addAll(titleText, text, description); }
Example 9
Source File: AutocompleteMenu.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** @param field Field where user entered text * @param text Text entered by user * @param proposal Matching proposal * @return AutocompleteItem that will apply the proposal */ private AutocompleteItem createItem(final TextInputControl field, final String text, final Proposal proposal) { final TextFlow markup = new TextFlow(); for (MatchSegment seg: proposal.getMatch(text)) { final Label match = new Label(seg.getDescription()); switch (seg.getType()) { case MATCH: match.setTextFill(Color.BLUE); match.setFont(highlight_font); break; case COMMENT: match.setTextFill(Color.GRAY); match.setFont(highlight_font); break; case NORMAL: default: } markup.getChildren().add(match); } return new AutocompleteItem(markup, () -> { final String value = proposal.apply(text); field.setText(value); field.positionCaret(value.length()); invokeAction(field); }); }
Example 10
Source File: JFXTimePickerContent.java From JFoenix with Apache License 2.0 | 5 votes |
private StackPane createMinutesContent(LocalTime time) { // create minutes content StackPane minsPointer = new StackPane(); Circle selectionCircle = new Circle(contentCircleRadius / 6); selectionCircle.fillProperty().bind(timePicker.defaultColorProperty()); Circle minCircle = new Circle(selectionCircle.getRadius() / 8); minCircle.setFill(Color.rgb(255, 255, 255, 0.87)); minCircle.setTranslateX(selectionCircle.getRadius() - minCircle.getRadius()); minCircle.setVisible(time.getMinute() % 5 != 0); selectedMinLabel.textProperty().addListener((o, oldVal, newVal) -> { if (Integer.parseInt(newVal) % 5 == 0) { minCircle.setVisible(false); } else { minCircle.setVisible(true); } }); double shift = 9; Line line = new Line(shift, 0, contentCircleRadius, 0); line.fillProperty().bind(timePicker.defaultColorProperty()); line.strokeProperty().bind(line.fillProperty()); line.setStrokeWidth(1.5); minsPointer.getChildren().addAll(line, selectionCircle, minCircle); StackPane.setAlignment(selectionCircle, Pos.CENTER_LEFT); StackPane.setAlignment(minCircle, Pos.CENTER_LEFT); Group pointerGroup = new Group(); pointerGroup.getChildren().add(minsPointer); pointerGroup.setTranslateX((-contentCircleRadius + shift) / 2); minsPointerRotate = new Rotate(0, contentCircleRadius - shift, selectionCircle.getRadius()); pointerGroup.getTransforms().add(minsPointerRotate); Pane clockLabelsContainer = new Pane(); // inner circle radius double radius = contentCircleRadius - shift - selectionCircle.getRadius(); for (int i = 0; i < 12; i++) { StackPane labelContainer = new StackPane(); int val = ((i + 3) * 5) % 60; Label label = new Label(String.valueOf(unitConverter.toString(val))); label.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12)); // init label color label.setTextFill(val == time.getMinute() ? Color.rgb(255, 255, 255, 0.87) : Color.rgb(0, 0, 0, 0.87)); selectedMinLabel.textProperty().addListener((o, oldVal, newVal) -> { if (Integer.parseInt(newVal) == Integer.parseInt(label.getText())) { label.setTextFill(Color.rgb(255, 255, 255, 0.87)); } else { label.setTextFill(Color.rgb(0, 0, 0, 0.87)); } }); labelContainer.getChildren().add(label); double labelSize = (selectionCircle.getRadius() / Math.sqrt(2)) * 2; labelContainer.setMinSize(labelSize, labelSize); double angle = 2 * i * Math.PI / 12; double xOffset = radius * Math.cos(angle); double yOffset = radius * Math.sin(angle); final double startx = contentCircleRadius + xOffset; final double starty = contentCircleRadius + yOffset; labelContainer.setLayoutX(startx - labelContainer.getMinWidth() / 2); labelContainer.setLayoutY(starty - labelContainer.getMinHeight() / 2); // add label to the parent node clockLabelsContainer.getChildren().add(labelContainer); } minsPointerRotate.setAngle(180 + (time.getMinute() + 45) % 60 * Math.toDegrees(2 * Math.PI / 60)); return new StackPane(pointerGroup, clockLabelsContainer); }
Example 11
Source File: FlyoutDemo.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** * Creates and returns demo widget * @return the control for demo-ing widget */ public GridPane getStuffControl() { GridPane gp = new GridPane(); gp.setPadding(new Insets(5, 5, 5, 5)); gp.setHgap(5); ComboBox<String> stuffCombo = new ComboBox<>(); stuffCombo.setEditable(true); stuffCombo.setPromptText("Add stuff..."); stuffCombo.getItems().addAll( "Stuff", "contained", "within", "the", "combo" ); Label l = new Label("Select or enter example text:"); l.setFont(Font.font(l.getFont().getFamily(), 10)); l.setTextFill(Color.WHITE); Button add = new Button("Add"); add.setOnAction(e -> stuffCombo.getItems().add(stuffCombo.getSelectionModel().getSelectedItem())); Button del = new Button("Clear"); del.setOnAction(e -> stuffCombo.getSelectionModel().clearSelection()); gp.add(l, 0, 0, 2, 1); gp.add(stuffCombo, 0, 1, 2, 1); gp.add(add, 2, 1); gp.add(del, 3, 1); return gp; }
Example 12
Source File: NumberTileSkin.java From OEE-Designer with MIT License | 5 votes |
@Override protected void initGraphics() { super.initGraphics(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); valueText = new Text(String.format(locale, formatString, ((tile.getValue() - minValue) / range * 100))); valueText.setFill(tile.getValueColor()); valueText.setTextOrigin(VPos.BASELINE); Helper.enableNode(valueText, tile.isValueVisible()); unitText = new Text(" " + tile.getUnit()); unitText.setFill(tile.getUnitColor()); unitText.setTextOrigin(VPos.BASELINE); Helper.enableNode(unitText, !tile.getUnit().isEmpty()); valueUnitFlow = new TextFlow(valueText, unitText); valueUnitFlow.setTextAlignment(TextAlignment.RIGHT); description = new Label(tile.getText()); description.setAlignment(tile.getDescriptionAlignment()); description.setWrapText(true); description.setTextFill(tile.getTextColor()); Helper.enableNode(description, tile.isTextVisible()); getPane().getChildren().addAll(titleText, text, valueUnitFlow, description); }
Example 13
Source File: BlackLevelGenerator.java From testing-video with GNU General Public License v3.0 | 5 votes |
private static Label text(Resolution res, ColorMatrix matrix, int col) { Label l = new Label(Integer.toString(getLuma(matrix, col))); l.setFont(font(res.height / 54)); l.setTextFill(gray(matrix.fromLumaCode(matrix.YMIN * 4))); l.setTextAlignment(TextAlignment.CENTER); l.setAlignment(Pos.CENTER); l.setPrefSize(getW(res.width, col), getLabelH(res.height)); return l; }
Example 14
Source File: IconSwitchSkin.java From Enzo with Apache License 2.0 | 5 votes |
private void initGraphics() { Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.5 * PREFERRED_HEIGHT)); // "OpenSans" font = Font.font("Open Sans", 0.5 * PREFERRED_HEIGHT); background = new Region(); background.getStyleClass().setAll("background"); background.setStyle("-switch-color: " + Util.colorToCss((Color) getSkinnable().getSwitchColor()) + ";"); symbol = getSkinnable().getSymbol(); symbol.setMouseTransparent(true); text = new Label(getSkinnable().getText()); text.setTextAlignment(TextAlignment.CENTER); text.setAlignment(Pos.CENTER); text.setTextFill(getSkinnable().getSymbolColor()); text.setFont(font); thumb = new Region(); thumb.getStyleClass().setAll("thumb"); thumb.setStyle("-thumb-color: " + Util.colorToCss((Color) getSkinnable().getThumbColor()) + ";"); thumb.setMouseTransparent(true); pane = new Pane(background, symbol, text, thumb); pane.getStyleClass().setAll("icon-switch"); moveToDeselected = new TranslateTransition(Duration.millis(180), thumb); moveToSelected = new TranslateTransition(Duration.millis(180), thumb); // Add all nodes getChildren().setAll(pane); }
Example 15
Source File: StockTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { super.initGraphics(); averagingListener = o -> handleEvents("AVERAGING_PERIOD"); timeFormatter = DateTimeFormatter.ofPattern("HH:mm", tile.getLocale()); state = State.CONSTANT; if (tile.isAutoScale()) tile.calcAutoScale(); low = tile.getMaxValue(); high = tile.getMinValue(); movingAverage = tile.getMovingAverage(); noOfDatapoints = tile.getAveragingPeriod(); dataList = new LinkedList<>(); // To get smooth lines in the chart we need at least 4 values if (noOfDatapoints < 4) throw new IllegalArgumentException("Please increase the averaging period to a value larger than 3."); graphBounds = new Rectangle(PREFERRED_WIDTH * 0.05, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.45); titleText = new Text(tile.getTitle()); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); valueText = new Text(String.format(locale, formatString, tile.getValue())); valueText.setBoundsType(TextBoundsType.VISUAL); valueText.setFill(tile.getValueColor()); Helper.enableNode(valueText, tile.isValueVisible()); valueUnitFlow = new TextFlow(valueText); valueUnitFlow.setTextAlignment(TextAlignment.RIGHT); highText = new Text(); highText.setTextOrigin(VPos.BOTTOM); highText.setFill(tile.getValueColor()); lowText = new Text(); lowText.setTextOrigin(VPos.TOP); lowText.setFill(tile.getValueColor()); text = new Text(tile.getText()); text.setTextOrigin(VPos.TOP); text.setFill(tile.getTextColor()); timeSpanText = new Text(""); timeSpanText.setTextOrigin(VPos.TOP); timeSpanText.setFill(tile.getTextColor()); Helper.enableNode(timeSpanText, !tile.isTextVisible()); referenceLine = new Line(); referenceLine.getStrokeDashArray().addAll(3d, 3d); referenceLine.setVisible(false); pathElements = new ArrayList<>(noOfDatapoints); pathElements.add(0, new MoveTo()); for (int i = 1 ; i < noOfDatapoints ; i++) { pathElements.add(i, new LineTo()); } sparkLine = new Path(); sparkLine.getElements().addAll(pathElements); sparkLine.setFill(null); sparkLine.setStroke(tile.getBarColor()); sparkLine.setStrokeWidth(PREFERRED_WIDTH * 0.0075); sparkLine.setStrokeLineCap(StrokeLineCap.ROUND); sparkLine.setStrokeLineJoin(StrokeLineJoin.ROUND); dot = new Circle(); dot.setFill(tile.getBarColor()); dot.setVisible(false); triangle = new Path(); triangle.setStroke(null); triangle.setFill(state.color); indicatorPane = new StackPane(triangle); changeText = new Label(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", (tile.getCurrentValue() - tile.getReferenceValue()))); changeText.setTextFill(state.color); changeText.setAlignment(Pos.CENTER_RIGHT); changePercentageText = new Text(new StringBuilder().append(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", (tile.getCurrentValue() / tile.getReferenceValue() * 100.0) - 100.0)).append(Helper.PERCENTAGE).toString()); changePercentageText.setFill(state.color); changePercentageFlow = new TextFlow(indicatorPane, changePercentageText); changePercentageFlow.setTextAlignment(TextAlignment.RIGHT); getPane().getChildren().addAll(titleText, valueUnitFlow, sparkLine, dot, referenceLine, highText, lowText, timeSpanText, text, changeText, changePercentageFlow); }
Example 16
Source File: SwitchTileSkin.java From OEE-Designer with MIT License | 4 votes |
@SuppressWarnings("rawtypes") @Override protected void initGraphics() { super.initGraphics(); mouseEventHandler = e -> { final EventType TYPE = e.getEventType(); if (MouseEvent.MOUSE_PRESSED == TYPE) { tile.setActive(!tile.isActive()); tile.fireEvent(SWITCH_PRESSED); } else if(MouseEvent.MOUSE_RELEASED == TYPE) { tile.fireEvent(SWITCH_RELEASED); } }; selectedListener = o -> moveThumb(); timeline = new Timeline(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); description = new Label(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); description.setWrapText(true); description.setTextFill(tile.getTextColor()); Helper.enableNode(description, !tile.getDescription().isEmpty()); switchBorder = new Rectangle(); switchBackground = new Rectangle(); switchBackground.setMouseTransparent(true); switchBackground.setFill(tile.isActive() ? tile.getActiveColor() : tile.getBackgroundColor()); thumb = new Circle(); thumb.setMouseTransparent(true); thumb.setEffect(shadow); getPane().getChildren().addAll(titleText, text, description, switchBorder, switchBackground, thumb); }
Example 17
Source File: BreakingNewsDemoView.java From htm.java-examples with GNU Affero General Public License v3.0 | 4 votes |
/** * Creates the monitor view * @return */ public LabelledRadiusPane createActivityPane() { LabelledRadiusPane retVal = new LabelledRadiusPane("Activity Monitor"); HBox h = new HBox(); h.setFillHeight(true); h.setSpacing(15); h.setPadding(new Insets(0, 10, 10, 15)); h.prefWidthProperty().bind(retVal.widthProperty()); h.layoutYProperty().bind(retVal.labelHeightProperty().add(20)); TextArea area = new TextArea(); area.prefWidthProperty().bind(h.widthProperty().subtract(30).divide(2)); area.prefHeightProperty().bind(retVal.heightProperty().subtract(60)); area.setLayoutY(retVal.labelHeightProperty().add(0).get()); leftActivityPanelProperty.set(area); TextArea area2 = new TextArea(); area2.prefWidthProperty().bind(h.widthProperty().subtract(60).divide(2)); area2.prefHeightProperty().bind(retVal.heightProperty().subtract(60)); area2.setLayoutY(retVal.labelHeightProperty().add(0).get()); area2.textProperty().addListener((v, o, n) -> { area2.setScrollTop(Double.MAX_VALUE); area2.setScrollLeft(Double.MAX_VALUE); }); rightActivityPanelProperty.set(area2); h.getChildren().addAll(area, area2); Label l = new Label("Output"); l.setFont(Font.font("Helvetica", FontWeight.BOLD, 14)); l.setTextFill(Color.rgb(00, 70, 107)); l.layoutXProperty().bind(area.widthProperty().divide(2).add(area.getLayoutX()).subtract(l.getWidth())); l.setLayoutY(area.getLayoutY() - l.getHeight()); Label l2 = new Label("Similar Tweets"); l2.setFont(Font.font("Helvetica", FontWeight.BOLD, 14)); l2.setTextFill(Color.rgb(00, 70, 107)); area2.layoutBoundsProperty().addListener((v, o, n) -> { l2.setLayoutX(area.getWidth() + 60 + area2.getWidth() / 2 - l2.getWidth()); }); l2.setLayoutY(area2.getLayoutY() - l.getHeight()); retVal.getChildren().addAll(h, l, l2); return retVal; }
Example 18
Source File: OverView.java From CrazyAlpha with GNU General Public License v2.0 | 4 votes |
public OverView() { root = new Pane(); Game.getInstance().resetMedia(); GameMap map = Game.getInstance().getMapManager().getCurrentMap(); ImageView mapIv = new ImageView(map.getMapImage()); mapIv.setFitWidth(Game.getInstance().getWidth()); mapIv.setFitHeight(Game.getInstance().getHeight()); Label nameLbl = new Label("Game Over!"); nameLbl.setTextFill(Color.WHITESMOKE); nameLbl.setFont(Game.getInstance().getResouceManager().getFont("Starcraft", 80)); nameLbl.setLayoutX(50); nameLbl.setLayoutY(50); Label scoreLbl = new Label(); scoreLbl.setTextFill(Color.WHITESMOKE); scoreLbl.setFont(Game.getInstance().getResouceManager().getFont("Starcraft", 60)); scoreLbl.setLayoutX(50); scoreLbl.setLayoutY(map.getHeight() - scoreLbl.getHeight() - 140); if (Game.getInstance().getScore() > Game.getInstance().getDataManager().getHighestScore()) { // 刷新高分记录! scoreLbl.setText("New Record: " + Game.getInstance().getScore()); Game.getInstance().getDataManager().setHighestScore(Game.getInstance().getScore()); } else scoreLbl.setText("Score: " + Game.getInstance().getScore()); Reflection reflection = new Reflection(); reflection.setFraction(1.0); nameLbl.setEffect(reflection); ImageView homeBtn = new ImageView(Game.getInstance().getResouceManager().getControl("btn_home")); homeBtn.setFitWidth(165 * 1.5); homeBtn.setFitHeight(65 * 1.5); homeBtn.setLayoutX(map.getWidth() - homeBtn.getFitWidth() - 20); homeBtn.setLayoutY(map.getHeight() - homeBtn.getFitHeight() - 60); homeBtn.setEffect(reflection); homeBtn.setOnMouseEntered(event -> { homeBtn.setEffect(new Glow(0.8)); Game.getInstance().getButtonOverMusic().play(); }); homeBtn.setOnMouseExited(event -> { homeBtn.setEffect(reflection); Game.getInstance().getButtonOverMusic().stop(); }); homeBtn.setOnMousePressed(event -> { homeBtn.setEffect(new GaussianBlur()); Game.getInstance().getButtonClickMusic().play(); }); homeBtn.setOnMouseReleased(event -> { homeBtn.setEffect(new Glow(0.8)); Game.getInstance().home(); }); root.getChildren().add(mapIv); root.getChildren().add(nameLbl); root.getChildren().add(scoreLbl); root.getChildren().add(homeBtn); makeFadeTransition(homeBtn, 2000, 1, 0.7); makeFadeTransition(mapIv, 3000, 1, 0.8); makeScaleTransition(mapIv, 10000, 0.25, 0.25); }
Example 19
Source File: RefImplToolBar.java From FXMaps with GNU Affero General Public License v3.0 | 4 votes |
/** * Creates and returns the control for loading maps * @return the control for loading stored maps */ public GridPane getMapControl() { GridPane gp = new GridPane(); gp.setPadding(new Insets(5, 5, 5, 5)); gp.setHgap(5); gp.setVgap(5); Button gpxLoader = getGPXLoadControl(); gpxLoader.setPrefHeight(15); Label l = new Label("Select or enter map name:"); l.setFont(Font.font(l.getFont().getFamily(), 12)); l.setTextFill(Color.WHITE); Button add = new Button("Add"); add.disableProperty().set(true); add.setOnAction(e -> mapCombo.valueProperty().set(mapCombo.getEditor().getText())); Button clr = new Button("Erase map"); clr.disableProperty().set(true); clr.setOnAction(e -> map.eraseMap()); Button del = new Button("Delete map"); del.disableProperty().set(true); del.setOnAction(e -> { map.clearMap(); map.deleteMap(mapCombo.getEditor().getText()); mapCombo.getItems().remove(mapCombo.getEditor().getText()); mapCombo.getSelectionModel().clearSelection(); mapCombo.getEditor().clear(); map.setMode(Mode.NORMAL); mapChooser.fire(); map.setOverlayVisible(true); routeChooser.setDisable(true); }); mapCombo.getEditor().textProperty().addListener((v, o, n) -> { if(mapCombo.getEditor().getText() != null && mapCombo.getEditor().getText().length() > 0) { add.disableProperty().set(false); if(map.getMapStore().getMap(mapCombo.getEditor().getText()) != null) { clr.disableProperty().set(false); del.disableProperty().set(false); }else{ clr.disableProperty().set(true); del.disableProperty().set(true); } }else{ add.disableProperty().set(true); clr.disableProperty().set(true); del.disableProperty().set(true); } }); gp.add(gpxLoader, 0, 0, 2, 1); gp.add(new Separator(), 0, 1, 2, 1); gp.add(l, 0, 2, 2, 1); gp.add(mapCombo, 0, 3, 3, 1); gp.add(add, 3, 3); gp.add(clr, 4, 3); gp.add(del, 5, 3); return gp; }
Example 20
Source File: SpectraIdentificationResultsWindowFX.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public SpectraIdentificationResultsWindowFX() { super(); pnMain = new BorderPane(); this.setScene(new Scene(pnMain)); getScene().getStylesheets() .addAll(MZmineCore.getDesktop().getMainWindow().getScene().getStylesheets()); pnMain.setPrefSize(1000, 600); pnMain.setMinSize(700, 500); setMinWidth(700); setMinHeight(500); setTitle("Processing..."); pnGrid = new GridPane(); // any number of rows noMatchesFound = new Label("I'm working on it"); noMatchesFound.setFont(headerFont); // yellow noMatchesFound.setTextFill(Color.web("0xFFCC00")); pnGrid.add(noMatchesFound, 0, 0); pnGrid.setVgap(5); // Add the Windows menu MenuBar menuBar = new MenuBar(); // menuBar.add(new WindowsMenu()); Menu menu = new Menu("Menu"); // set font size of chart MenuItem btnSetup = new MenuItem("Setup dialog"); btnSetup.setOnAction(e -> { Platform.runLater(() -> { if (MZmineCore.getConfiguration() .getModuleParameters(SpectraIdentificationResultsModule.class) .showSetupDialog(true) == ExitCode.OK) { showExportButtonsChanged(); } }); }); menu.getItems().add(btnSetup); CheckMenuItem cbCoupleZoomY = new CheckMenuItem("Couple y-zoom"); cbCoupleZoomY.setSelected(true); cbCoupleZoomY.setOnAction(e -> setCoupleZoomY(cbCoupleZoomY.isSelected())); menu.getItems().add(cbCoupleZoomY); menuBar.getMenus().add(menu); pnMain.setTop(menuBar); scrollPane = new ScrollPane(pnGrid); pnMain.setCenter(scrollPane); scrollPane.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); totalMatches = new ArrayList<>(); matchPanels = new HashMap<>(); setCoupleZoomY(true); show(); }