javafx.scene.layout.Background Java Examples

The following examples show how to use javafx.scene.layout.Background. 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: TileSparklineSkin.java    From Medusa with 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(size * 0.025), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(size * 0.025), Insets.EMPTY)));

    locale       = gauge.getLocale();
    formatString = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString();

    titleText.setText(gauge.getTitle());
    subTitleText.setText(gauge.getSubTitle());
    resizeStaticText();

    titleText.setFill(gauge.getTitleColor());
    valueText.setFill(gauge.getValueColor());
    averageText.setFill(gauge.getAverageColor());
    highText.setFill(gauge.getValueColor());
    lowText.setFill(gauge.getValueColor());
    subTitleText.setFill(gauge.getSubTitleColor());
    sparkLine.setStroke(gauge.getBarColor());
    stdDeviationArea.setFill(Helper.getTranslucentColorFrom(gauge.getAverageColor(), 0.1));
    averageLine.setStroke(gauge.getAverageColor());
    dot.setFill(gauge.getBarColor());
}
 
Example #2
Source File: AlarmTreeView.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** @param model Model to represent. Must <u>not</u> be running, yet */
public AlarmTreeView(final AlarmClient model)
{
    if (model.isRunning())
        throw new IllegalStateException();

    changing.setTextFill(Color.WHITE);
    changing.setBackground(new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY)));

    this.model = model;

    tree_view.setShowRoot(false);
    tree_view.setCellFactory(view -> new AlarmTreeViewCell());
    tree_view.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    setTop(createToolbar());
    setCenter(tree_view);

    tree_view.setRoot(createViewItem(model.getRoot()));

    model.addListener(this);

    createContextMenu();
    addClickSupport();
    addDragSupport();
}
 
Example #3
Source File: ProcessController.java    From tools-ocr with GNU Lesser General Public License v3.0 6 votes vote down vote up
public ProcessController(){
    VBox vBox = new VBox();
    vBox.setAlignment(Pos.BASELINE_CENTER);
    vBox.setMinWidth(300);
    vBox.setBackground(new Background(new BackgroundFill(Color.rgb(250, 250, 250), CornerRadii.EMPTY, Insets.EMPTY)));
    ProgressIndicator progressIndicator = new ProgressIndicator();
    progressIndicator.setStyle(CommUtils.STYLE_TRANSPARENT);
    int circleSize = 75;
    progressIndicator.setMinWidth(circleSize);
    progressIndicator.setMinHeight(circleSize);
    Label topLab = new Label("正在识别图片,请稍等.....");
    topLab.setFont(Font.font(18));
    vBox.setSpacing(10);
    vBox.setPadding(new Insets(20, 0, 20, 0));
    vBox.getChildren().add(progressIndicator);
    vBox.getChildren().add(topLab);
    Scene scene = new Scene(vBox, Color.TRANSPARENT);
    setScene(scene);
    initStyle(StageStyle.TRANSPARENT);
    CommUtils.initStage(this);
}
 
Example #4
Source File: SunburstChart.java    From charts with 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 #5
Source File: KpiDashboard.java    From medusademo with Apache License 2.0 6 votes vote down vote up
@Override public void init() {
    Label title = new Label("December 2015");
    title.setFont(Font.font(24));

    revenue = getBulletChart("Revenue", "($'000)", 600, 500, new Section(0, 200, RED), new Section(200, 400, YELLOW), new Section(400, 600, GREEN));
    profit  = getBulletChart("Profit", "($'000)", 100, 70, new Section(0, 20, RED), new Section(20, 60, YELLOW), new Section(60, 100, GREEN));
    sales   = getBulletChart("Sales", "(unit)", 1000, 700, new Section(0, 300, RED), new Section(300, 500, YELLOW), new Section(500, 1000, GREEN));

    HBox legend = new HBox(getLegendBox(RED, "Poor", 10),
                           getLegendBox(YELLOW, "Average", 10),
                           getLegendBox(GREEN, "Good", 10),
                           getLegendBox(GRAY, "Target", 5));
    legend.setSpacing(20);
    legend.setAlignment(Pos.CENTER);

    pane = new VBox(title, revenue, profit, sales, legend);
    pane.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setPadding(new Insets(20, 20, 20, 20));
    pane.setSpacing(10);
}
 
Example #6
Source File: FxDump.java    From FxDock with Apache License 2.0 6 votes vote down vote up
protected String describeBackground(Background b)
{
	SB sb = new SB();
	sb.a("Background<");
	boolean sep = false;
	for(BackgroundFill f: b.getFills())
	{
		if(sep)
		{
			sb.a(",");
		}
		else
		{
			sep = true;
		}
		sb.a(describe(f));
	}
	sb.a(">");
	return sb.toString();
}
 
Example #7
Source File: JFXTextAreaSkin.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
    super.layoutChildren(x, y, w, h);

    final double height = getSkinnable().getHeight();
    linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3);
    errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h);
    linesWrapper.updateLabelFloatLayout();


    if (invalid) {
        invalid = false;
        // set the default background of text area viewport to white
        Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0);
        viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
            CornerRadii.EMPTY,
            Insets.EMPTY)));
        // reapply css of scroll pane in case set by the user
        viewPort.applyCss();
        errorContainer.invalid(w);
        // focus
        linesWrapper.invalid();
    }
}
 
Example #8
Source File: DesignClockSkin.java    From Medusa with 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 #9
Source File: SunburstChart.java    From OEE-Designer with 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 File: SlimSkin.java    From Medusa with 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 #11
Source File: TextSymbolRepresentation.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
@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 #12
Source File: TileSkin.java    From OEE-Designer with MIT License 6 votes vote down vote up
protected void initGraphics() {
    // Set initial size
    if (Double.compare(tile.getPrefWidth(), 0.0) <= 0 || Double.compare(tile.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(tile.getWidth(), 0.0) <= 0 || Double.compare(tile.getHeight(), 0.0) <= 0) {
        if (tile.getPrefWidth() > 0 && tile.getPrefHeight() > 0) {
            tile.setPrefSize(tile.getPrefWidth(), tile.getPrefHeight());
        } else {
            tile.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 3, 0, 0, 0);

    notifyRegion = new NotifyRegion();
    enableNode(notifyRegion, false);

    pane = new Pane(notifyRegion);
    pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(tile.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example #13
Source File: NavigationTabsRepresentation.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** @param content_model Model to represent */
private void representContent(final DisplayModel content_model)
{
    try
    {
        toolkit.representModel(body, content_model);
        // Set 'body' of navtabs to color of the embedded model
        body.setBackground(new Background(new BackgroundFill(JFXUtil.convert(content_model.propBackgroundColor().getValue()), CornerRadii.EMPTY, Insets.EMPTY)));
    }
    catch (final Exception ex)
    {
        logger.log(Level.WARNING, "Failed to represent embedded display", ex);
    }
    finally
    {
        toolkit.onRepresentationFinished();
    }
}
 
Example #14
Source File: MainScene.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates the new ticker billboard
 */
public void createBillboard() {

	matrix = DotMatrixBuilder.create().prefSize(925, 54).colsAndRows(196, 11).dotOnColor(Color.rgb(255, 55, 0))
			.dotOffColor(Color.rgb(64, 64, 64)).dotShape(DotShape.ROUND).matrixFont(MatrixFont8x8.INSTANCE).build();

	billboard = new StackPane(matrix);
	// billboard.setPadding(new Insets(1));
	billboard.setBackground(
			new Background(new BackgroundFill(Color.rgb(20, 20, 20), CornerRadii.EMPTY, Insets.EMPTY)));
	// billboard.setBorder(new Border(new BorderStroke(Color.DARKCYAN,
	// BorderStrokeStyle.DOTTED, CornerRadii.EMPTY, BorderWidths.FULL)));
	dragNode = new DraggableNode(billboard, stage, 925, 54);

	dragNode.setCache(true);
	dragNode.setCacheShape(true);
	dragNode.setCacheHint(CacheHint.SPEED);
}
 
Example #15
Source File: QueryPageListPane.java    From oim-fx with MIT License 6 votes vote down vote up
private void initComponent() {
	this.getChildren().add(listRootPane);
	//this.setAlignment(Pos.BOTTOM_CENTER);

	flowPane.setPadding(new Insets(15, 10, 0, 10));
	flowPane.setVgap(10);
	flowPane.setHgap(10);
	flowPane.setPrefWrapLength(900); // 预设流面板的宽度,使得能够显示两列

	scrollPane.setBackground(Background.EMPTY);
	scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
	scrollPane.setContent(flowPane);

	centerPane.getChildren().add(scrollPane);
	centerPane.getChildren().add(waitingPanel);

	centerPane.setStyle("-fx-background-color:rgba(255, 255, 255, 0.7)");

	listRootPane.setCenter(centerPane);
	listRootPane.setBottom(page);
	listRootPane.setStyle("-fx-background-color:rgba(255, 255, 255, 0.9)");
	VBox.setVgrow(listRootPane, Priority.ALWAYS);
	this.showWaiting(false, WaitingPane.show_waiting);
	this.setPage(0, 1);
}
 
Example #16
Source File: SpaceXSkin.java    From Medusa with 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 #17
Source File: RadarChart.java    From tilesfx with Apache License 2.0 6 votes vote down vote up
private void resize() {
    double width  = getWidth() - getInsets().getLeft() - getInsets().getRight();
    double height = getHeight() - getInsets().getTop() - getInsets().getBottom();
    size          = width < height ? width : height;

    if (size > 0) {
        pane.setMaxSize(size, size);
        pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5);
        pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY)));

        chartCanvas.setWidth(size);
        chartCanvas.setHeight(size);

        overlayCanvas.setWidth(size);
        overlayCanvas.setHeight(size);

        redraw();
    }
}
 
Example #18
Source File: OverlayPane.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
/**
 */
public OverlayPane()
{
	super();
	super.getChildren().add(canvasPane);
	setBackground(new Background(new BackgroundFill(Color.BLACK.deriveColor(0.0, 1.0, 1.0, 0.0), CornerRadii.EMPTY, Insets.EMPTY)));

	this.overlayRenderers = new CopyOnWriteArrayList<>();

	final ChangeListener<Number> sizeChangeListener = (observable, oldValue, newValue)
			-> {
		final double wd = widthProperty().get();
		final double hd = heightProperty().get();
		final int    w  = (int) wd;
		final int    h  = (int) hd;
		if (w <= 0 || h <= 0)
			return;
		overlayRenderers.forEach(or -> or.setCanvasSize(w, h));
		layout();
		drawOverlays();
	};

	widthProperty().addListener(sizeChangeListener);
	heightProperty().addListener(sizeChangeListener);

}
 
Example #19
Source File: MultiGaugeDemo.java    From medusademo with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(gauge);
    pane.setPadding(new Insets(20));
    pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Medusa MultiGauge");
    stage.setScene(scene);
    stage.show();

    timer.start();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example #20
Source File: BarChartItem.java    From tilesfx with 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);
        }
    }

    nameText = new Text(getName());
    nameText.setTextOrigin(VPos.TOP);

    valueText = new Text(String.format(locale, formatString, getValue()));
    valueText.setTextOrigin(VPos.TOP);

    barBackground = new Rectangle();

    bar = new Rectangle();

    pane = new Pane(nameText, valueText, barBackground, bar);
    pane.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example #21
Source File: Slim1Skin.java    From medusademo with 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 #22
Source File: JFXToggleNodeSkin.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
public void updateSelectionBackground() {
    CornerRadii radii = getSkinnable().getBackground() == null ? CornerRadii.EMPTY : getSkinnable().getBackground()
        .getFills()
        .get(0)
        .getRadii();
    Insets insets = getSkinnable().getBackground() == null ? Insets.EMPTY : getSkinnable().getBackground()
        .getFills()
        .get(0)
        .getInsets();
    selectionOverLay.setBackground(new Background(new BackgroundFill(getSkinnable().isSelected() ? ((JFXToggleNode) getSkinnable())
        .getSelectedColor() : ((JFXToggleNode) getSkinnable()).getUnSelectedColor(), radii, insets)));
}
 
Example #23
Source File: TileSkin.java    From OEE-Designer with MIT License 5 votes vote down vote up
protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, tile.getRoundedCorners() ? new CornerRadii(clamp(0, Double.MAX_VALUE, size * 0.025)) : CornerRadii.EMPTY, new BorderWidths(clamp(0, Double.MAX_VALUE, tile.getBorderWidth() / PREFERRED_WIDTH * size)))));
    pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), tile.getRoundedCorners() ? new CornerRadii(clamp(0, Double.MAX_VALUE, size * 0.025)) : CornerRadii.EMPTY, Insets.EMPTY)));
    notifyRegion.setRoundedCorner(tile.getRoundedCorners());
    notifyRegion.setBackgroundColor(tile.getNotificationBackgroundColor());
    notifyRegion.setForegroundColor(tile.getNotificationForegroundColor());

    locale          = tile.getLocale();
    formatString    = new StringBuilder("%.").append(Integer.toString(tile.getDecimals())).append("f").toString();
    sectionsVisible = tile.getSectionsVisible();
    textSize        = tile.getTextSize();
}
 
Example #24
Source File: AlarmUI.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** @return Label that indicates missing server connection */
public static Label createNoServerLabel()
{
    final Label no_server = new Label("No Alarm Server Connection");
    no_server.setTextFill(Color.WHITE);
    no_server.setBackground(new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY)));
    return no_server;
}
 
Example #25
Source File: TilesFXSeries.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
public TilesFXSeries(final Series<X, Y> SERIES, final Paint STROKE, final Paint FILL, final Background SYMBOL_BACKGROUND, final Paint LEGEND_SYMBOL_FILL) {
    series           = SERIES;
    stroke           = STROKE;
    fill             = FILL;
    symbolBackground = SYMBOL_BACKGROUND;
    legendSymbolFill = LEGEND_SYMBOL_FILL;
}
 
Example #26
Source File: TilesFXSeries.java    From OEE-Designer with MIT License 5 votes vote down vote up
public TilesFXSeries(final Series<X, Y> SERIES, final Paint STROKE, final Paint FILL) {
    series = SERIES;
    stroke = STROKE;
    fill   = FILL;
    if (null != stroke & null != fill) {
        symbolBackground = new Background(new BackgroundFill(STROKE, new CornerRadii(5), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(5), new Insets(2)));
        legendSymbolFill = stroke;
    }
}
 
Example #27
Source File: CustomGaugeSkin.java    From medusademo with Apache License 2.0 5 votes vote down vote up
private void redraw() {
    pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
    sectionsVisible    = getSkinnable().getSectionsVisible();
    barBackgroundColor = getSkinnable().getBarBackgroundColor();
    barColor           = getSkinnable().getBarColor();
    drawBackground();
    setBar(getSkinnable().getCurrentValue());
}
 
Example #28
Source File: ScaleBarSample.java    From arcgis-runtime-samples-java with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) {

  // create stack pane and application scene
  StackPane stackPane = new StackPane();
  Scene scene = new Scene(stackPane);

  // set title, size and scene to stage
  stage.setTitle("Scale Bar Sample");
  stage.setWidth(800);
  stage.setHeight(700);
  stage.setScene(scene);
  stage.show();

  // create a map view
  mapView = new MapView();
  ArcGISMap map = new ArcGISMap(Basemap.Type.IMAGERY, 64.1405, -16.2426, 16);
  mapView.setMap(map);

  // create a scale bar for the map view
  Scalebar scaleBar = new Scalebar(mapView);

  // specify skin style for the scale bar
  scaleBar.setSkinStyle(Scalebar.SkinStyle.GRADUATED_LINE);

  // set the unit system (default is METRIC)
  scaleBar.setUnitSystem(UnitSystem.IMPERIAL);

  // to enhance visibility of the scale bar, by making background transparent
  Color transparentWhite = new Color(1, 1, 1, 0.7);
  scaleBar.setBackground(new Background(new BackgroundFill(transparentWhite, new CornerRadii(5), Insets.EMPTY)));

  // add the map view and scale bar to stack pane
  stackPane.getChildren().addAll(mapView, scaleBar);

  // set position of scale bar
  StackPane.setAlignment(scaleBar, Pos.BOTTOM_CENTER);
  // give padding to scale bar
  StackPane.setMargin(scaleBar, new Insets(0, 0, 50, 0));
}
 
Example #29
Source File: BatterySkin.java    From Medusa with Apache License 2.0 5 votes vote down vote up
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    batteryBackground = new Path();
    batteryBackground.setFillRule(FillRule.EVEN_ODD);
    batteryBackground.setStroke(null);

    battery = new Path();
    battery.setFillRule(FillRule.EVEN_ODD);
    battery.setStroke(null);

    valueText = new Text(String.format(locale, "%.0f%%", gauge.getCurrentValue()));
    valueText.setVisible(gauge.isValueVisible());
    valueText.setManaged(gauge.isValueVisible());

    // Add all nodes
    pane = new Pane();
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
    pane.getChildren().setAll(batteryBackground, battery, valueText);

    getChildren().setAll(pane);
}
 
Example #30
Source File: FindUserItem.java    From oim-fx with MIT License 5 votes vote down vote up
private Node getGapNode(double value) {
	AnchorPane tempPane = new AnchorPane();
	tempPane.setPrefWidth(value);
	tempPane.setPrefHeight(value);
	tempPane.setBackground(Background.EMPTY);
	return tempPane;
}