Java Code Examples for javafx.scene.layout.Border

The following examples show how to use javafx.scene.layout.Border. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: Open-Lowcode   Source File: ClientDisplay.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @return a display with no page shown
 */
public Node getEmptyDisplay() {
	logger.severe("Setting empty display");
	BorderPane mainpane = new BorderPane();
	mainpane.setBackground(new Background(new BackgroundFill(Color.WHITE, null, null)));
	connectionbar = new ConnectionBar(this, urltoconnectto, this.questionmarkicon);

	this.userinteractionwidgets.add(connectionbar);

	Pane connectionpanel = connectionbar.getPane();
	mainpane.setTop(connectionpanel);
	BorderPane.setMargin(connectionpanel, new Insets(3, 5, 3, 5));
	Pane statusbar = generateStatusBar();

	mainpane.setBottom(statusbar);
	BorderPane.setMargin(statusbar, new Insets(3, 5, 3, 5));
	ScrollPane contentholder = new ScrollPane();
	contentholder.setStyle("-fx-background: rgb(255,255,255);");
	contentholder.setBorder(Border.EMPTY);
	mainpane.setCenter(contentholder);
	this.contentholder = contentholder;
	return mainpane;

}
 
Example 2
Source Project: Open-Lowcode   Source File: CCollapsibleBand.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Node getNode(
		PageActionManager actionmanager,
		CPageData inputdata,
		Window parentwindow,
		TabPane[] parenttabpanes,
		CollapsibleNode nodetocollapsewhenactiontriggered) {
	Node payloadnode = payload.getNode(actionmanager, inputdata, parentwindow, parenttabpanes,
			(closewheninlineactioninside ? this : null));
	collapsiblepane = new TitledPane(this.title, payloadnode);
	collapsiblepane.setCollapsible(true);
	collapsiblepane.setExpanded(this.openbydefault);
	collapsiblepane.setBorder(Border.EMPTY);
	collapsiblepane.setAnimated(false);

	return collapsiblepane;
}
 
Example 3
Source Project: Medusa   Source File: TileClockSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(size * 0.025), new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(size * 0.025), Insets.EMPTY)));

    shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null);
    shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null);
    shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null);

    // Tick Marks
    minuteTickMarks.setStroke(clock.getMinuteColor());
    hourTickMarks.setStroke(clock.getHourColor());

    ZonedDateTime time = clock.getTime();

    updateTime(time);

    resizeText();

    title.setFill(clock.getTitleColor());
    dateText.setFill(clock.getDateColor());
    text.setFill(clock.getTextColor());
    amPmText.setFill(clock.getTextColor());
}
 
Example 4
Source Project: img2latex-mathpix   Source File: BackGridPane.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Method to set ImageView style and add a BorderPane for border plotting.
 *
 * @param imageView ImageView to be customised.
 * @return customised ImageView with BorderPane.
 */
private BorderPane setImageViewBorder(ImageView imageView) {
    // preserve image ratio
    imageView.setPreserveRatio(true);
    // maximum width is 390 maximum height is 150
    // image larger than the above size will be scaled down
    imageView.setFitWidth(PREFERRED_WIDTH);
    imageView.setFitHeight(PREFERRED_HEIGHT);

    var borderPane = new BorderPane(imageView);

    // use BorderPane to add a border stroke to the ImageView
    borderPane.setBorder(new Border(PANE_BORDER_STROKE));
    borderPane.setPrefSize(PREFERRED_WIDTH, 110);

    return borderPane;
}
 
Example 5
Source Project: Medusa   Source File: TinySkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    locale               = gauge.getLocale();
    formatString         = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString();
    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();

    barBackground.setStroke(gauge.getBarBackgroundColor());

    // Areas, Sections and Tick Marks
    sectionCanvas.setCache(false);
    sectionCtx.clearRect(0, 0, size, size);
    if (gauge.isGradientBarEnabled() && gauge.getGradientLookup() != null) {
        drawGradientBar();
        if (gauge.getMajorTickMarksVisible()) drawTickMarks();
    } else if (gauge.getSectionsVisible()) {
        drawSections();
        if (gauge.getMajorTickMarksVisible()) drawTickMarks();
    }
    sectionCanvas.setCache(true);
    sectionCanvas.setCacheHint(CacheHint.QUALITY);

    needle.setFill(gauge.getNeedleColor());
}
 
Example 6
Source Project: dev-tools   Source File: GeneratorController.java    License: Apache License 2.0 6 votes vote down vote up
@FXML
private void handleGeneratePasswordAction(final ActionEvent actionEvent) {
    int length;
    try {
        pwdLength.setBorder(Border.EMPTY);
        length = validatePasswordLength();
    } catch (Exception e) {
        pwdLength.setBorder(Elements.alertBorder);
        return;
    }
    PasswordGenerator generator = new PasswordGenerator.PasswordGeneratorBuilder()
            .withLowerChars(pwdLowChars.isSelected())
            .withDigits(pwdDigits.isSelected())
            .withUpperChars(pwdUpperChars.isSelected())
            .withSymbols(pwdSymbols.isSelected())
            .build();
    generatorResult.setText(generator.generate(length));
}
 
Example 7
Source Project: oim-fx   Source File: FreeComboBox.java    License: MIT License 6 votes vote down vote up
private void initComponent() {
	this.getStyleClass().add(DEFAULT_STYLE_CLASS);

	textField.getStyleClass().remove("text-field");
	textField.setBackground(Background.EMPTY);
	textField.setBorder(Border.EMPTY);

	// button.getStyleClass().remove("button");
	// button.setGraphic(arrows);
	// button.getStyleClass().add("free-arrow-button");

	arrowButton.getChildren().add(arrows);
	// pane.getChildren().add(button);
	arrowButton.getStyleClass().add("free-arrow-button");

	this.setCenter(textField);
	this.setRight(arrowButton);
}
 
Example 8
Source Project: Medusa   Source File: DashboardSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / 250 * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    barBackground.setFill(gauge.getBarBackgroundColor());
    barBackground.setEffect(gauge.isShadowsEnabled() ? innerShadow : null);

    setBarColor(gauge.getCurrentValue());

    dataBar.setEffect(gauge.isShadowsEnabled() ? innerShadow : null);

    threshold.setStroke(gauge.getThresholdColor());
    double thresholdInnerRadius = 0.3 * height;
    double thresholdOuterRadius = 0.675 * height;
    double thresholdAngle       = Helper.clamp(90.0, 270.0, (gauge.getThreshold() - minValue) * angleStep + 90.0);
    threshold.setStartX(centerX + thresholdInnerRadius * Math.sin(-Math.toRadians(thresholdAngle)));
    threshold.setStartY(centerX + thresholdInnerRadius * Math.cos(-Math.toRadians(thresholdAngle)));
    threshold.setEndX(centerX + thresholdOuterRadius * Math.sin(-Math.toRadians(thresholdAngle)));
    threshold.setEndY(centerX + thresholdOuterRadius * Math.cos(-Math.toRadians(thresholdAngle)));

    redrawText();
}
 
Example 9
Source Project: OEE-Designer   Source File: SunburstChart.java    License: MIT License 6 votes vote down vote up
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    segmentPane = new Pane();

    chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    chartCanvas.setMouseTransparent(true);

    chartCtx    = chartCanvas.getGraphicsContext2D();

    pane = new Pane(segmentPane, chartCanvas);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);

    prepareData();
}
 
Example 10
Source Project: phoebus   Source File: ThermometerRepresentation.java    License: Eclipse Public License 1.0 6 votes vote down vote up
Thermo(Color color)
{
    setFill(color);

    fill.setArcHeight(6);
    fill.setArcWidth(6);
    fill.setManaged(false);
    border.setFill(new LinearGradient(.3, 0, .7, 0, true, CycleMethod.NO_CYCLE,
            new Stop(0, Color.LIGHTGRAY),
            new Stop(.3, Color.WHITESMOKE),
            new Stop(1, Color.LIGHTGRAY)));
    border.setStroke(Color.BLACK);
    arc.setLargeArcFlag(true);
    rightcorner.setY(0);

    getChildren().add(border);
    getChildren().add(fill);
    getChildren().add(ellipse);
    setBorder(new Border(
            new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
}
 
Example 11
Source Project: phoebus   Source File: RegionBaseRepresentation.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/** Create alarm-based border
 *  @param severity AlarmSeverity
 *  @param corners CornerRadii
 *  @return Border
 */
private static Border createAlarmBorder(final AlarmSeverity severity, final CornerRadii corners)
{
    switch (severity)
    {
    case NONE:
        // No alarm -> no border
        return null;
    case MINOR:
        // Minor -> Simple border
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], solid, corners, normal));
    case MAJOR:
        // Major -> Double border
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], solid, corners, thin),
                          new BorderStroke(alarm_colors[severity.ordinal()], solid, corners, thin, new Insets(-2*thin.getTop())));
    case INVALID:
        // Invalid -> Border is cleverly interrupted just like the communication to the control system
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], dash_dotted, corners, normal));
    case UNDEFINED:
    default:
        // Disconnected -> Dotted
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], dotted, corners, wide));
    }
}
 
Example 12
Source Project: Medusa   Source File: SlimSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    titleText.setText(gauge.getTitle());
    unitText.setText(gauge.getUnit());
    resizeStaticText();

    barBackground.setStroke(gauge.getBarBackgroundColor());
    setBarColor(gauge.getCurrentValue());
    titleText.setFill(gauge.getTitleColor());
    valueText.setFill(gauge.getValueColor());
    unitText.setFill(gauge.getUnitColor());
}
 
Example 13
Source Project: Medusa   Source File: TextClockSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void initGraphics() {
    // Set initial size
    if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) {
        if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) {
            clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight());
        } else {
            clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    timeText = new Text();
    timeText.setTextOrigin(VPos.CENTER);
    timeText.setFill(textColor);

    dateText = new Text();
    dateText.setTextOrigin(VPos.CENTER);
    dateText.setFill(dateColor);

    pane = new Pane(timeText, dateText);
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(clock.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example 14
Source Project: charts   Source File: SunburstChart.java    License: Apache License 2.0 6 votes vote down vote up
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    segmentPane = new Pane();

    chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    chartCanvas.setMouseTransparent(true);

    chartCtx    = chartCanvas.getGraphicsContext2D();

    pane = new Pane(segmentPane, chartCanvas);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);

    prepareData();
}
 
Example 15
Source Project: Medusa   Source File: SpaceXSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * width))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
    barColor                 = gauge.getBarColor();
    thresholdColor           = gauge.getThresholdColor();
    barBackgroundColor       = gauge.getBarBackgroundColor();
    thresholdBackgroundColor = Color.color(thresholdColor.getRed(), thresholdColor.getGreen(), thresholdColor.getBlue(), 0.25);
    barBackground.setFill(barBackgroundColor);
    thresholdBar.setFill(thresholdBackgroundColor);
    dataBar.setFill(barColor);
    dataBarThreshold.setFill(thresholdColor);

    titleText.setFill(gauge.getTitleColor());
    titleText.setText(gauge.getTitle());

    valueText.setFill(gauge.getValueColor());
    valueText.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));

    unitText.setFill(gauge.getUnitColor());
    unitText.setText(gauge.getUnit());
    
    resizeStaticText();
    resizeValueText();
    
}
 
Example 16
Source Project: Medusa   Source File: DigitalSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    
    locale          = gauge.getLocale();
    barColor        = gauge.getBarColor();
    valueColor      = gauge.getValueColor();
    titleColor      = gauge.getTitleColor();
    subTitleColor   = gauge.getSubTitleColor();
    unitColor       = gauge.getUnitColor();
    sectionsVisible = gauge.getSectionsVisible();
    drawBackground();

    setBar(gauge.getCurrentValue());

    valueBkgText.setFill(gauge.isShadowsEnabled() ? Helper.getTranslucentColorFrom(valueColor, 0.1) : Color.TRANSPARENT);

    valueText.setFill(valueColor);
}
 
Example 17
Source Project: tilesfx   Source File: SunburstChart.java    License: Apache License 2.0 6 votes vote down vote up
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    segmentPane = new Pane();

    chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    chartCanvas.setMouseTransparent(true);

    chartCtx    = chartCanvas.getGraphicsContext2D();

    pane = new Pane(segmentPane, chartCanvas);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);

    prepareData();
}
 
Example 18
Source Project: Medusa   Source File: DesignClockSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    shadowGroup.setEffect(clock.getShadowsEnabled() ? dropShadow : null);

    // Tick Marks
    tickCanvas.setCache(false);
    drawTicks();
    tickCanvas.setCache(true);
    tickCanvas.setCacheHint(CacheHint.QUALITY);

    needle.setStroke(clock.getHourColor());

    ZonedDateTime time = clock.getTime();

    updateTime(time);
}
 
Example 19
Source Project: medusademo   Source File: TemplateClockSkin.java    License: Apache License 2.0 6 votes vote down vote up
private void initGraphics() {
    // Set initial size
    if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 ||
        Double.compare(getSkinnable().getWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getHeight(), 0.0) <= 0) {
        if (getSkinnable().getPrefWidth() > 0 && getSkinnable().getPrefHeight() > 0) {
            getSkinnable().setPrefSize(getSkinnable().getPrefWidth(), getSkinnable().getPrefHeight());
        } else {
            getSkinnable().setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    pane = new Pane();
    pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(getSkinnable().getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example 20
Source Project: Medusa   Source File: FlatSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));

    setBarColor(gauge.getCurrentValue());
    valueText.setFill(gauge.getValueColor());
    unitText.setFill(gauge.getUnitColor());
    titleText.setFill(gauge.getTitleColor());
    separator.setStroke(gauge.getBorderPaint());

    titleText.setText(gauge.getTitle());
    resizeTitleText();

    unitText.setText(gauge.getUnit());
    resizeUnitText();
}
 
Example 21
Source Project: medusademo   Source File: CustomGaugeSkin.java    License: Apache License 2.0 6 votes vote down vote up
private void initGraphics() {
    backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    backgroundCtx    = backgroundCanvas.getGraphicsContext2D();

    foregroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    foregroundCtx    = foregroundCanvas.getGraphicsContext2D();

    ledInnerShadow   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 0.2 * PREFERRED_WIDTH, 0, 0, 0);
    ledDropShadow    = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getBarColor(), 0.3 * PREFERRED_WIDTH, 0, 0, 0);

    pane = new Pane(backgroundCanvas, foregroundCanvas);
    pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
    pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example 22
Source Project: Medusa   Source File: SlimClockSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / 250 * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    
    secondBackgroundCircle.setStroke(Helper.getTranslucentColorFrom(clock.getSecondColor(), 0.2));
    secondArc.setStroke(clock.getSecondColor());

    hour.setFill(clock.getHourColor());
    minute.setFill(clock.getMinuteColor());
    
    dateText.setFill(clock.getDateColor());
    dateNumbers.setFill(clock.getDateColor());

    hour.setFill(clock.getHourColor());
    minute.setFill(clock.getMinuteColor());

    ZonedDateTime time = clock.getTime();
    updateTime(time);
}
 
Example 23
Source Project: Medusa   Source File: DigitalClockSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void initGraphics() {
    // Set initial size
    if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) {
        if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) {
            clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight());
        } else {
            clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ctx = canvas.getGraphicsContext2D();

    pane = new Pane(canvas);
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(clock.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example 24
Source Project: Medusa   Source File: RoundLcdClockSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    ZonedDateTime time = clock.getTime();

    hourColor       = clock.getHourColor();
    minuteColor     = clock.getMinuteColor();
    fiveMinuteColor = minuteColor.darker();
    secondColor     = clock.getSecondColor();
    titleColor      = clock.getTitleColor();
    textColor       = clock.getTextColor();
    dateColor       = clock.getDateColor();
    alarmColor      = clock.getAlarmColor();

    drawBackground();
    drawForeground(time);
    drawHours(time);
    drawMinutes(time);
    drawSeconds(time);
}
 
Example 25
Source Project: img2latex-mathpix   Source File: PressCopyTextField.java    License: Apache License 2.0 5 votes vote down vote up
public PressCopyTextField() {

        setPrefWidth(220);
        setPrefHeight(20);

        // UI.PressCopyTextField is not editable
        setEditable(false);

        setBorder(new Border(BORDER_STROKE));

        setFont(Font.font(14));

        // initialise with black text colour
        setStyle("-fx-text-inner-color: black;");

        // text colour turns to light blue when mouse enters the UI.PressCopyTextField
        addEventHandler(MouseEvent.MOUSE_ENTERED, event -> setStyle("-fx-text-inner-color: #3d93f7;"));

        // text colour turns back to black when mouse exits the UI.PressCopyTextField
        addEventHandler(MouseEvent.MOUSE_EXITED, event -> setStyle("-fx-text-inner-color: black;"));

        // put the formatted text into clipboard when the UI.PressCopyTextField is clicked
        addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
            if (getLength() > 0) {
                // copy text if there is text
                UIUtils.putStringIntoClipboard(formattedText);
            }
        });

        // moves the caret before the first char of the text
        focusedProperty().addListener((observable, oldValue, newValue) -> {
            if (newValue) {
                Platform.runLater(this::home);
            }
        });

    }
 
Example 26
Source Project: dev-tools   Source File: EpochController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void handleTsToHumanEpoch(final ActionEvent event) {
    tsToHumanField.setBorder(Border.EMPTY);
    try {
        LocalDateTime dt = EpochService.tsToLocalDateTime(tsToHumanField.getText());
        String result = EpochService.toHumanEpoch(dt);
        tsToHumanResult.setText(result);
    } catch (Exception e) {
        tsToHumanField.setBorder(Elements.alertBorder);
        tsToHumanResult.setText("");
    }
}
 
Example 27
Source Project: dev-tools   Source File: EpochController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void handleMillisToTime(final ActionEvent actionEvent) {
    tsToHumanField.setBorder(Border.EMPTY);
    try {
        long millis = Long.parseLong(tsToHumanField.getText());
        String result = DurationFormatUtils.formatDurationWords(millis, true, true);
        tsToHumanResult.setText(result);
    } catch (Exception e) {
        tsToHumanField.setBorder(Elements.alertBorder);
        tsToHumanResult.setText("");
    }
}
 
Example 28
Source Project: dev-tools   Source File: LogsController.java    License: Apache License 2.0 5 votes vote down vote up
private void reset() {
    delayLowerField.setBorder(Border.EMPTY);
    delayUpperField.setBorder(Border.EMPTY);
    limitField.setBorder(Border.EMPTY);
    outputFileField.setBorder(Border.EMPTY);
    logMessage.setText("");
}
 
Example 29
Source Project: dev-tools   Source File: RestAPITabController.java    License: Apache License 2.0 5 votes vote down vote up
private boolean validateInput() {
    uriTextField.setBorder(Border.EMPTY);
    if (uriTextField.getText().isEmpty()) {
        uriTextField.setBorder(Elements.alertBorder);
        return false;
    }
    return true;
}
 
Example 30
Source Project: oim-fx   Source File: FlatTab.java    License: MIT License 5 votes vote down vote up
private void initComponent() {
	imageButton.getStyleClass().clear();
	imageButton.setBackground(Background.EMPTY);
	imageButton.setBorder(Border.EMPTY);
	imageButton.setFocusTraversable(false);
	imageButton.setGraphic(imageView);

	stackPane.getChildren().add(imageButton);
	borderPane.setCenter(stackPane);
	
	this.setIconPadding(new Insets(5,0,5,0));
	this.getChildren().add(borderPane);
	
	// hBox.setStyle("-fx-background-color:rgba(194, 194, 173, 1)");
}