Java Code Examples for javafx.scene.layout.BorderStrokeStyle#SOLID
The following examples show how to use
javafx.scene.layout.BorderStrokeStyle#SOLID .
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: RichTextArea.java From Open-Lowcode with Eclipse Public License 2.0 | 5 votes |
/** * make the widget glow (blue glow showing the active widget) */ public void makeGlow() { Border border = new Border(new BorderStroke(Color.web("#039ED3"), BorderStrokeStyle.SOLID, new CornerRadii(2), BorderWidths.DEFAULT, new Insets(0, 0, 0, 0))); area.setBorder(border); }
Example 2
Source File: CalendarTileSkin.java From OEE-Designer with MIT License | 5 votes |
@Override protected void initGraphics() { super.initGraphics(); final ZonedDateTime TIME = tile.getTime(); titleText = new Text(MONTH_YEAR_FORMATTER.format(TIME)); titleText.setFill(tile.getTitleColor()); clickHandler = e -> checkClick(e); labels = new ArrayList<>(56); for (int i = 0 ; i < 56 ; i++) { Label label = new Label(); label.setManaged(false); label.setVisible(false); label.setAlignment(Pos.CENTER); label.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler); labels.add(label); } weekBorder = new Border(new BorderStroke(Color.TRANSPARENT, Tile.GRAY, Color.TRANSPARENT, Color.TRANSPARENT, BorderStrokeStyle.NONE, BorderStrokeStyle.SOLID, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE, CornerRadii.EMPTY, BorderWidths.DEFAULT, Insets.EMPTY)); text = new Text(DAY_FORMATTER.format(TIME)); text.setFill(tile.getTextColor()); getPane().getChildren().addAll(titleText, text); getPane().getChildren().addAll(labels); }
Example 3
Source File: CalendarTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@Override protected void initGraphics() { super.initGraphics(); final ZonedDateTime TIME = tile.getTime(); titleText = new Text(MONTH_YEAR_FORMATTER.format(TIME)); titleText.setFill(tile.getTitleColor()); clickHandler = e -> checkClick(e); labels = new ArrayList<>(56); for (int i = 0 ; i < 56 ; i++) { Label label = new Label(); label.setManaged(false); label.setVisible(false); label.setAlignment(Pos.CENTER); label.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler); labels.add(label); } weekBorder = new Border(new BorderStroke(Color.TRANSPARENT, Tile.GRAY, Color.TRANSPARENT, Color.TRANSPARENT, BorderStrokeStyle.NONE, BorderStrokeStyle.SOLID, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE, CornerRadii.EMPTY, BorderWidths.DEFAULT, Insets.EMPTY)); text = new Text(DAY_FORMATTER.format(TIME)); text.setFill(tile.getTextColor()); getPane().getChildren().addAll(titleText, text); getPane().getChildren().addAll(labels); }
Example 4
Source File: CalendarTileSkin.java From OEE-Designer with MIT License | 4 votes |
private void drawCells() { List<ChartData> dataList = tile.getChartData(); ZonedDateTime time = tile.getTime(); Locale locale = tile.getLocale(); int day = time.getDayOfMonth(); int startDay = time.withDayOfMonth(1).getDayOfWeek().getValue(); long lastDay = time.range(DAY_OF_MONTH).getMaximum(); Color textColor = tile.getTextColor(); Color bkgColor = tile.getBackgroundColor(); Font regFont = Fonts.latoRegular(size * 0.045); Font bldFont = Fonts.latoBold(size * 0.045); Background bkgToday = new Background(new BackgroundFill(tile.getBarColor(), new CornerRadii(size * 0.0125), new Insets(2))); Border appmntBorder = new Border(new BorderStroke(tile.getAlarmColor(), tile.getAlarmColor(), tile.getAlarmColor(), tile.getAlarmColor(), BorderStrokeStyle.SOLID, BorderStrokeStyle.SOLID, BorderStrokeStyle.SOLID, BorderStrokeStyle.SOLID, new CornerRadii(size * 0.0125), BorderWidths.DEFAULT, new Insets(1))); boolean counting = false; int dayCounter = 1; for (int y = 0 ; y < 7 ; y++) { for (int x = 0 ; x < 8 ; x++) { int index = y * 8 + x; Label label = labels.get(index); String text; if (x == 0 && y == 0) { text = ""; label.setManaged(false); label.setVisible(false); } else if (y == 0) { text = DayOfWeek.of(x).getDisplayName(TextStyle.SHORT, locale); //label.setTextFill(x == 7 ? Tile.RED : textColor); label.setTextFill(textColor); label.setFont(bldFont); } else if (x == 0) { text = Integer.toString(time.withDayOfMonth(1).plusDays((y - 1) * 7).get(IsoFields.WEEK_OF_WEEK_BASED_YEAR)); label.setTextFill(Tile.GRAY); label.setFont(regFont); label.setBorder(weekBorder); } else { if (index - 7 > startDay) { counting = true; text = Integer.toString(dayCounter); LocalDate currentDay = time.toLocalDate().plusDays(dayCounter - 1); long appointments = dataList.stream().filter(data -> data.getTimestampAsLocalDate().isEqual(currentDay)).count(); if (x == 7) { if (appointments > 0) { label.setBorder(appmntBorder); } else { label.setBorder(null); } label.setTextFill(Tile.RED); label.setFont(regFont); } else if (dayCounter == day) { if (appointments > 0) { label.setBorder(appmntBorder); } else { label.setBorder(null); } label.setBackground(bkgToday); label.setTextFill(bkgColor); label.setFont(bldFont); } else { if (appointments > 0) { label.setBorder(appmntBorder); } else { label.setBorder(null); } label.setTextFill(textColor); label.setFont(regFont); } } else { text = ""; label.setManaged(false); label.setVisible(false); } if (dayCounter > lastDay) { text = ""; label.setManaged(false); label.setVisible(false); } if (counting) { dayCounter++; } } label.setText(text); label.setVisible(true); label.setManaged(true); label.setPrefSize(cellWidth, cellHeight); label.relocate(x * cellWidth + cellOffsetX, y * cellHeight + cellOffsetY); } } }
Example 5
Source File: CalendarTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
private void drawCells() { List<ChartData> dataList = tile.getChartData(); ZonedDateTime time = tile.getTime(); Locale locale = tile.getLocale(); int day = time.getDayOfMonth(); int startDay = time.withDayOfMonth(1).getDayOfWeek().getValue(); long lastDay = time.range(DAY_OF_MONTH).getMaximum(); Color textColor = tile.getTextColor(); Color bkgColor = tile.getBackgroundColor(); Font regFont = Fonts.latoRegular(size * 0.045); Font bldFont = Fonts.latoBold(size * 0.045); Background bkgToday = new Background(new BackgroundFill(tile.getBarColor(), new CornerRadii(size * 0.0125), new Insets(2))); Border appmntBorder = new Border(new BorderStroke(tile.getAlarmColor(), tile.getAlarmColor(), tile.getAlarmColor(), tile.getAlarmColor(), BorderStrokeStyle.SOLID, BorderStrokeStyle.SOLID, BorderStrokeStyle.SOLID, BorderStrokeStyle.SOLID, new CornerRadii(size * 0.0125), BorderWidths.DEFAULT, new Insets(1))); boolean counting = false; int dayCounter = 1; for (int y = 0 ; y < 7 ; y++) { for (int x = 0 ; x < 8 ; x++) { int index = y * 8 + x; Label label = labels.get(index); String text; if (x == 0 && y == 0) { text = ""; label.setManaged(false); label.setVisible(false); } else if (y == 0) { text = DayOfWeek.of(x).getDisplayName(TextStyle.SHORT, locale); //label.setTextFill(x == 7 ? Tile.RED : textColor); label.setTextFill(textColor); label.setFont(bldFont); } else if (x == 0) { text = Integer.toString(time.withDayOfMonth(1).plusDays((y - 1) * 7).get(IsoFields.WEEK_OF_WEEK_BASED_YEAR)); label.setTextFill(Tile.GRAY); label.setFont(regFont); label.setBorder(weekBorder); } else { if (index - 7 > startDay) { counting = true; text = Integer.toString(dayCounter); LocalDate currentDay = time.toLocalDate().plusDays(dayCounter - 1); long appointments = dataList.stream().filter(data -> data.getTimestampAsLocalDate().isEqual(currentDay)).count(); if (x == 7) { if (appointments > 0) { label.setBorder(appmntBorder); } else { label.setBorder(null); } label.setTextFill(Tile.RED); label.setFont(regFont); } else if (dayCounter == day) { if (appointments > 0) { label.setBorder(appmntBorder); } else { label.setBorder(null); } label.setBackground(bkgToday); label.setTextFill(bkgColor); label.setFont(bldFont); } else { int currentDayCounter = dayCounter; if (dataList.stream().filter(data -> data.getTimestampAsLocalDate().getDayOfMonth() == currentDayCounter).count() > 0) { label.setBorder(appmntBorder); } else { label.setBorder(null); } label.setTextFill(textColor); label.setFont(regFont); } } else { text = ""; label.setManaged(false); label.setVisible(false); } if (dayCounter > lastDay) { text = ""; label.setManaged(false); label.setVisible(false); } if (counting) { dayCounter++; } } label.setText(text); label.setVisible(true); label.setManaged(true); label.setPrefSize(cellWidth, cellHeight); label.relocate(x * cellWidth + cellOffsetX, y * cellHeight + cellOffsetY); } } }
Example 6
Source File: ChargeSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void resize() { width = gauge.getWidth() - gauge.getInsets().getLeft() - gauge.getInsets().getRight(); height = gauge.getHeight() - gauge.getInsets().getTop() - gauge.getInsets().getBottom(); if (aspectRatio * width > height) { width = 1 / (aspectRatio / height); } else if (1 / (aspectRatio / height) > width) { height = aspectRatio * width; } if (width > 0 && height > 0) { pane.setMaxSize(width, height); pane.setPrefSize(width, height); pane.relocate((gauge.getWidth() - width) * 0.5, (gauge.getHeight() - height) * 0.5); pane.setSpacing(width * 0.01960784); double barWidth = 0; for (int i = 0 ; i < 12 ; i++) { bars[i].setPrefSize(0.3030303 * height, (0.3030303 * height + i * 0.06060606 * height)); Bounds bounds = bars[i].getLayoutBounds(); barWidth = bounds.getWidth(); if (barWidth == 0) return; BarColor barColor; if (i < 2) { barColor = BarColor.RED; } else if (i < 9) { barColor = BarColor.ORANGE; } else { barColor = BarColor.GREEN; } barBackgrounds[i] = new Background(new BackgroundFill[] { new BackgroundFill(Color.WHITE, new CornerRadii(1024), Insets.EMPTY), new BackgroundFill(new LinearGradient(0, bounds.getMinY(), 0, bounds.getMaxY(), false, CycleMethod.NO_CYCLE, new Stop(0.0, barColor.COLOR_FROM), new Stop(1.0, barColor.COLOR_TO)), new CornerRadii(1024), new Insets(0.15 * barWidth)) }); barBackgrounds[i + 12] = new Background(new BackgroundFill[] { new BackgroundFill(Color.WHITE, new CornerRadii(1024), Insets.EMPTY), new BackgroundFill(new LinearGradient(0, bounds.getMinY(), 0, bounds.getMaxY(), false, CycleMethod.NO_CYCLE, new Stop(0.0, BarColor.GRAY.COLOR_FROM), new Stop(1.0, BarColor.GRAY.COLOR_TO)), new CornerRadii(1024), new Insets(0.15 * barWidth)) }); } barBorder = new Border(new BorderStroke(Color.rgb(102, 102, 102), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(0.05 * barWidth))); } redraw(); }