Java Code Examples for javafx.scene.layout.Background

The following examples show how to use javafx.scene.layout.Background. 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: medusademo   Source File: MultiGaugeDemo.java    License: 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 2
Source Project: FxDock   Source File: FxDump.java    License: 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 3
Source Project: phoebus   Source File: AlarmTreeView.java    License: 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 4
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 5
Source Project: Medusa   Source File: TileSparklineSkin.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(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 6
Source Project: phoebus   Source File: TextSymbolRepresentation.java    License: 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 7
Source Project: mars-sim   Source File: MainScene.java    License: 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 8
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 9
Source Project: tilesfx   Source File: RadarChart.java    License: 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 10
Source Project: paintera   Source File: OverlayPane.java    License: 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 11
Source Project: tilesfx   Source File: BarChartItem.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);
        }
    }

    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 12
Source Project: medusademo   Source File: Slim1Skin.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: oim-fx   Source File: QueryPageListPane.java    License: 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 14
/** @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 15
Source Project: OEE-Designer   Source File: TileSkin.java    License: 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 16
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 17
Source Project: medusademo   Source File: KpiDashboard.java    License: 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 18
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 19
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 20
Source Project: JFoenix   Source File: JFXTextAreaSkin.java    License: 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 21
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 22
Source Project: charts   Source File: SunburstChart.java    License: Apache License 2.0 5 votes vote down vote up
private void redraw() {
    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 / PREFERRED_WIDTH * size))));

    segmentPane.setBackground(new Background(new BackgroundFill(getBackgroundColor(), CornerRadii.EMPTY, Insets.EMPTY)));
    segmentPane.setManaged(isInteractive());
    segmentPane.setVisible(isInteractive());

    drawChart();
}
 
Example 23
Source Project: Medusa   Source File: DigitalSkin.java    License: 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);
        }
    }

    backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    backgroundCtx    = backgroundCanvas.getGraphicsContext2D();
    
    barCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    barCtx    = barCanvas.getGraphicsContext2D();

    valueBkgText = new Text();
    valueBkgText.setStroke(null);
    valueBkgText.setFill(Helper.getTranslucentColorFrom(valueColor, 0.1));

    valueText = new Text();
    valueText.setStroke(null);
    valueText.setFill(valueColor);
    Helper.enableNode(valueText, gauge.isValueVisible());

    pane = new Pane(backgroundCanvas, barCanvas, valueBkgText, valueText);
    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()))));

    getChildren().setAll(pane);
}
 
Example 24
Source Project: phoebus   Source File: SymbolRepresentation.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected StackPane createJFXNode ( ) throws Exception {

    autoSize = model_widget.propAutoSize().getValue();
    symbol = getDefaultSymbol();

    StackPane symbolPane = new StackPane();

    indexLabelBackground.setStroke(Color.LIGHTGRAY.deriveColor(0.0, 1.0, 1.0, 0.75));
    indexLabelBackground.setVisible(model_widget.propShowIndex().getValue());

    indexLabel.setAlignment(Pos.CENTER);
    indexLabel.setFont(Font.font(indexLabel.getFont().getFamily(), FontWeight.BOLD, 16));
    indexLabel.setTextFill(Color.WHITE);
    indexLabel.setVisible(model_widget.propShowIndex().getValue());
    indexLabel.textProperty().bind(Bindings.convert(imageIndexProperty()));

    symbolPane.getChildren().addAll(getSymbolNode(), indexLabelBackground, indexLabel);

    if ( model_widget.propTransparent().getValue() ) {
        symbolPane.setBackground(null);
    } else {
        symbolPane.setBackground(new Background(new BackgroundFill(JFXUtil.convert(model_widget.propBackgroundColor().getValue()), CornerRadii.EMPTY, Insets.EMPTY)));
    }

    enabled = model_widget.propEnabled().getValue();

    Styles.update(symbolPane, Styles.NOT_ENABLED, !enabled);

    initialIndexChanged(null, null, null);
    symbolChanged(null, null, null);

    return symbolPane;

}
 
Example 25
Source Project: Open-Lowcode   Source File: ClientDisplay.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * generates the JAVAFX component for the status bar
 * 
 * @return the Pane
 */
public Pane generateStatusBar() {
	Label statusbar = new Label("");
	statusbar.setOnMouseClicked(new EventHandler<MouseEvent>() {

		@Override
		public void handle(MouseEvent event) {

			if (event.getButton().equals(MouseButton.SECONDARY)) {

				final ClipboardContent content = new ClipboardContent();
				content.putString(statusbar.getText());
				Clipboard.getSystemClipboard().setContent(content);
			} else {

				Alert alert = new Alert(AlertType.INFORMATION);
				alert.setTitle("Status Message");
				alert.setHeaderText("Status Message");
				alert.setContentText(statusbar.getText());

				alert.showAndWait();
			}

		}
	});
	this.statuslabel = statusbar;
	HBox statusbarpane = new HBox(5);
	statusbarpane.setBackground(new Background(new BackgroundFill(Color.WHITE, null, null)));
	statusbarpane.getChildren().add(statusbar);
	return statusbarpane;

}
 
Example 26
Source Project: regulators   Source File: Main.java    License: Apache License 2.0 5 votes vote down vote up
@Override public void start(Stage stage) {
    HBox pane = new HBox(regulator, feedbackRegulator, colorRegulator);
    pane.setSpacing(20);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(66,71,79), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example 27
Source Project: tilesfx   Source File: PercentageTileSkin.java    License: Apache License 2.0 5 votes vote down vote up
@Override protected void redraw() {
    super.redraw();
    titleText.setText(tile.getTitle());
    unitText.setText(tile.getUnit());
    description.setText(tile.getDescription());
    description.setAlignment(tile.getDescriptionAlignment());
    percentageText.setText(String.format(locale, "%." + tile.getDecimals() + "f", tile.getValue() / range * 100));
    maxValueText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMaxValue()));
    maxValueUnitText.setText(tile.getUnit());

    resizeStaticText();

    barBackground.setBackground(new Background(new BackgroundFill(tile.getBarBackgroundColor().brighter().brighter(), new CornerRadii(0.0, 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, false), Insets.EMPTY)));
    barColor = tile.getBarColor();

    if (sectionsVisible && !sections.isEmpty()) {
        setBarColor(tile.getValue());
    } else {
        bar.setFill(barColor);
    }

    titleText.setFill(tile.getTitleColor());
    unitText.setFill(tile.getUnitColor());
    description.setTextFill(tile.getDescriptionColor());
    maxValueText.setFill(tile.getBackgroundColor());
    maxValueUnitText.setFill(tile.getBackgroundColor());
    maxValueRect.setFill(Double.compare(tile.getCurrentValue(), maxValue) >= 0 ? barColor : tile.getThresholdColor());
    valueText.setFill(tile.getValueColor());
    unitText.setFill(tile.getUnitColor());

}
 
Example 28
Source Project: mars-sim   Source File: WaitIndicator.java    License: GNU General Public License v3.0 5 votes vote down vote up
public WaitIndicator(Stage stage) {	
  	this.stage = stage;
  	//stage = new Stage();
  	indicator = new CircularProgressIndicator();
      StackPane pane = new StackPane(indicator);
      
//stackPane.setScaleX(1.2);
//stackPane.setScaleY(1.2);

      pane.setBackground(Background.EMPTY);
      pane.setStyle(
   		   //"-fx-border-style: none; "
   		   //"-fx-background-color: #231d12; "
      			"-fx-background-color: transparent; "
      			+ 
      			"-fx-background-radius: 1px;"
   		   );
      
      Scene scene = new Scene(pane, 128, 128, true);

scene.setFill(Color.TRANSPARENT);

stage.requestFocus();
      stage.initStyle(StageStyle.TRANSPARENT);
      stage.setTitle("Circular Progress Indicator");
      stage.setScene(scene);
      stage.toFront();
      stage.show();
      
      indicator.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
  }
 
Example 29
@FXML public void onListenerButtonClicked(ActionEvent event) {
	new Thread(){
		public void run(){
			setName("compiling listener");
			try{
				if(myLocalListener==null){
					Platform.runLater(()->{
						sn.setDisable(true);
						textArea.setEditable(false);
					});
					myLocalListener=(IChannelEventListener) ScriptingEngine.inlineScriptStringRun(textArea.getText(), null, "Groovy");
					channel.addChannelEventListener(myLocalListener);
					Platform.runLater(()->{
						setListenerButton.setText("Kill Listener");
						setListenerButton.setBackground(new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY)));
					});
				}else{
					channel.removeChannelEventListener(myLocalListener);
					Platform.runLater(()->{
						sn.setDisable(false);
						textArea.setEditable(true);
						myLocalListener=null;
						setListenerButton.setBackground(new Background(new BackgroundFill(Color.GREEN, CornerRadii.EMPTY, Insets.EMPTY)));
						setListenerButton.setText("Set Listener");
					});
				}
			}catch(Exception e){
				BowlerStudioController.highlightException(null, e);
			}
		}
	}.start();

	
}
 
Example 30
public UIColor get() {
	Background background = this.target.get();
	if( background != null && background.getFills() != null ) {
		for(BackgroundFill fill : background.getFills()) {
			if( fill.getFill() instanceof Color ) {
				return new JFXColor((Color) fill.getFill());
			}
		}
	}
	return null;
}