Java Code Examples for javafx.scene.paint.Color#TRANSPARENT

The following examples show how to use javafx.scene.paint.Color#TRANSPARENT . 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: DemoLcd.java    From Enzo with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane();
    pane.setPadding(new Insets(10, 10, 10, 10));
    pane.getChildren().setAll(control);

    Scene scene = new Scene(pane, Color.TRANSPARENT);

    stage.setTitle("Lcd demo");
    stage.centerOnScreen();
    //stage.initStyle(StageStyle.UNDECORATED);
    stage.setScene(scene);
    stage.show();        
            
    timer.start();

    calcNoOfNodes(scene.getRoot());
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example 2
Source File: RectangleRepresentation.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
private void updateColors()
{
    final boolean transparent = model_widget.propTransparent().getValue();
    background = transparent
               ? Color.TRANSPARENT
               : JFXUtil.convert(model_widget.propBackgroundColor().getValue());
    line_color = JFXUtil.convert(model_widget.propLineColor().getValue());

    // Displays converted from EDM can have transparent rectangles
    // on top of other content, including buttons.
    // Such rectangles should pass mouse clicks through to the underlying widgets,
    // at runtime, unless there are actions on the rectangle
    // https://github.com/ControlSystemStudio/cs-studio/issues/2149
    ignore_mouse = transparent  &&
                   ! toolkit.isEditMode()  &&
                   model_widget.propActions().getValue().getActions().isEmpty();
}
 
Example 3
Source File: OverviewPanel.java    From constellation with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method that creates and styles a POV object.
 *
 * The POV object is a styled rectangle that is used to indicate the
 * currently observed time range (aka time extent) on the timeline. It can
 * also be used to quickly interact with the time extent.
 *
 * @return A formatted POV object.
 */
private Rectangle createPOV() {
    final Rectangle rect = new Rectangle(135, 25, 60, 1);

    // Bind the height of the POV to the Height of the histogram:
    rect.yProperty().bind(histogram.heightProperty());
    rect.heightProperty().bind(innerPane.prefHeightProperty());
    rect.setManaged(true);

    // Style the rectangle:
    rect.setStroke(Color.DODGERBLUE);
    rect.setStrokeWidth(2d);
    final LinearGradient gradient
            = new LinearGradient(0.0, 0.0, 0.0, 0.5, true, CycleMethod.NO_CYCLE, new Stop[]{
        new Stop(0, Color.LIGHTBLUE.darker()),
        new Stop(1, Color.TRANSPARENT)
    });
    rect.setFill(gradient);
    rect.setSmooth(true);

    // Round the edges of the rectangle:
    rect.setArcWidth(5.0);
    rect.setArcHeight(5.0);

    // Set the POV mouse event handlers:
    final POVMouseEventHandler handler = new POVMouseEventHandler(rect);
    rect.setOnMouseMoved(handler);
    rect.setOnMousePressed(handler);
    rect.setOnMouseDragged(handler);
    rect.setOnMouseReleased(handler);

    // Make the POV object the top-most object on this panel:
    rect.toFront();

    return rect;
}
 
Example 4
Source File: BorderPaneSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    StackPane sp = new StackPane();
    BorderPane borderPane = new BorderPane();

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    borderPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
 
    Rectangle recTop = new Rectangle(62, 5, Color.web("#349b00"));
    recTop.setStroke(Color.BLACK);
    Rectangle recBottom = new Rectangle(62, 14, Color.web("#349b00"));
    recBottom.setStroke(Color.BLACK);
    Rectangle recLeft = new Rectangle(20, 41, Color.TRANSPARENT);
    recLeft.setStroke(Color.BLACK);
    Rectangle recRight = new Rectangle(20, 41, Color.TRANSPARENT);
    recRight.setStroke(Color.BLACK);
    Rectangle centerRight = new Rectangle(20, 41, Color.TRANSPARENT);
    centerRight.setStroke(Color.BLACK);
    borderPane.setRight(recRight);
    borderPane.setTop(recTop);
    borderPane.setLeft(recLeft);
    borderPane.setBottom(recBottom);
    borderPane.setCenter(centerRight);
 
    sp.getChildren().addAll(rectangle, borderPane);
    return new Group(sp);
}
 
Example 5
Source File: CalendarTileSkin.java    From OEE-Designer with MIT License 5 votes vote down vote up
@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 6
Source File: XYChartItem.java    From charts with Apache License 2.0 4 votes vote down vote up
public XYChartItem(final double X, final double Y, final String NAME, final Color FILL) {
    this(X, Y, NAME, FILL, Color.TRANSPARENT, Symbol.NONE);
}
 
Example 7
Source File: XYChartItem.java    From charts with Apache License 2.0 4 votes vote down vote up
public XYChartItem(final double X, final double Y, final Color FILL) {
    this(X, Y, "", FILL, Color.TRANSPARENT, Symbol.NONE);
}
 
Example 8
Source File: TYChartItem.java    From charts with Apache License 2.0 4 votes vote down vote up
public TYChartItem(final LocalDateTime T, final double Y, final String NAME, final Color FILL, final Symbol SYMBOL) {
    super(T.toEpochSecond(Helper.getZoneOffset()), Y, NAME, FILL, Color.TRANSPARENT, SYMBOL);
    _t = T;
}
 
Example 9
Source File: StopWatchSample.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
private Rectangle createDotBackground() {
    Rectangle background = new Rectangle(8, 17, Color.TRANSPARENT);
    background.setStroke(Color.TRANSPARENT);
    background.setStrokeWidth(2);
    return background;
}
 
Example 10
Source File: Section.java    From Medusa with Apache License 2.0 4 votes vote down vote up
public Section(final double START, final double STOP, final Color COLOR, final Color HIGHLIGHT_COLOR) {
    this(START, STOP, "", null, COLOR, HIGHLIGHT_COLOR, Color.TRANSPARENT, "");
}
 
Example 11
Source File: ChartData.java    From OEE-Designer with MIT License 4 votes vote down vote up
public ChartData(final String NAME, final Instant TIMESTAMP) {
    this(NAME, 0, Tile.BLUE, Color.TRANSPARENT, Tile.FOREGROUND, TIMESTAMP, true, 800);
}
 
Example 12
Source File: Frosty.java    From Cryogen with GNU General Public License v2.0 4 votes vote down vote up
public Frosty(final Stage stage, Pane parent, Node content) {
    enabled = Options.fancyBlur;
    this.stage = stage;

    root.getChildren().setAll(shadow, layout);
    
    java.awt.Rectangle fullScreen = new java.awt.Rectangle(0, 0, screen.width, screen.height);
    java.awt.Robot robot = null;
    try {
        robot = new java.awt.Robot();
    } catch (java.awt.AWTException ex) {
    }
    desktop = robot.createScreenCapture(fullScreen);

    if (enabled) {
        layout.getChildren().setAll(background, content);
        layout.setStyle("-fx-background-color: null");
    } else {
        layout.setStyle("-fx-background-color: white");
    }
    
    parent.getChildren().add(root);

    Scene scene = new Scene(
            parent,
            1000, 600,
            Color.TRANSPARENT
    );

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

    //stage.setHeight(600);
    //stage.setWidth(800);
    Platform.setImplicitExit(false);

    scene.setOnMouseClicked(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent event) {
            if (event.getClickCount() == 2) //Platform.exit();
            {
                //setEnabled(!enabled, true);
                stage.toBack();
            }
        }
    });
    smoke = makeSmoke(stage);

    behind(
            (int) stage.getX(),
            (int) stage.getY(),
            (int) stage.getWidth(),
            (int) stage.getHeight()
    );
    setBlur(25);

    makeDraggable(stage, layout);

    stage.focusedProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
            focusing = t1;
            if (enabled) {
                if (focusing) {
                    capture();
                } else {
                    setEnabled(false, false);
                    tmpFocus = true;
                }
            }
        }
    });
}
 
Example 13
Source File: YSeries.java    From charts with Apache License 2.0 4 votes vote down vote up
public YSeries(final List<T> ITEMS, final ChartType TYPE, final String NAME) {
    this(ITEMS, TYPE, NAME, Color.TRANSPARENT, Color.BLACK, Symbol.CIRCLE);
}
 
Example 14
Source File: ChartData.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public ChartData(double VALUE) {
    this(null, "", VALUE, Tile.BLUE, Color.TRANSPARENT, Tile.FOREGROUND, Instant.now(), java.time.Duration.ZERO, true, 800);
}
 
Example 15
Source File: Section.java    From OEE-Designer with MIT License 4 votes vote down vote up
public Section(final double START, final double STOP, final Color COLOR, final Color HIGHLIGHT_COLOR) {
    this(START, STOP, "", null, COLOR, HIGHLIGHT_COLOR, Color.TRANSPARENT, "");
}
 
Example 16
Source File: SingleChartTest.java    From charts with Apache License 2.0 4 votes vote down vote up
@Override public void init() {
    List<XYChartItem> xyItem1 = new ArrayList<>(NO_OF_X_VALUES);
    List<XYChartItem> xyItem2 = new ArrayList<>(NO_OF_X_VALUES);
    List<XYChartItem> xyItem3 = new ArrayList<>(NO_OF_X_VALUES);
    List<XYChartItem> xyItem4 = new ArrayList<>(NO_OF_X_VALUES);

    for (int i = 0 ; i < NO_OF_X_VALUES ; i++) {
        xyItem1.add(new XYChartItem(i, RND.nextDouble() * 12 + RND.nextDouble() * 6, "P" + i, COLORS[RND.nextInt(3)]));
        xyItem2.add(new XYChartItem(i, RND.nextDouble() * 7 + RND.nextDouble() * 3, "P" + i, COLORS[RND.nextInt(3)]));
        xyItem3.add(new XYChartItem(i, RND.nextDouble() * 3 + RND.nextDouble() * 4, "P" + i, COLORS[RND.nextInt(3)]));
        xyItem4.add(new XYChartItem(i, RND.nextDouble() * 4, "P" + i, COLORS[RND.nextInt(3)]));
    }

    xySeries1 = new XYSeries(xyItem1, ChartType.LINE, Color.rgb(255, 0, 0, 0.5), Color.RED);
    xySeries2 = new XYSeries(xyItem2, ChartType.LINE, Color.rgb(0, 255, 0, 0.5), Color.LIME);
    xySeries3 = new XYSeries(xyItem3, ChartType.LINE, Color.rgb(0, 0, 255, 0.5), Color.BLUE);
    xySeries4 = new XYSeries(xyItem4, ChartType.LINE, Color.rgb(255, 0, 255, 0.5), Color.MAGENTA);

    xySeries1.setSymbolsVisible(false);
    xySeries2.setSymbolsVisible(false);
    xySeries3.setSymbolsVisible(false);
    xySeries4.setSymbolsVisible(false);

    // XYChart
    Converter tempConverter     = new Converter(TEMPERATURE, CELSIUS); // Type Temperature with BaseUnit Celsius
    double    tempFahrenheitMin = tempConverter.convert(0, FAHRENHEIT);
    double    tempFahrenheitMax = tempConverter.convert(20, FAHRENHEIT);

    lineChartXAxisBottom = createBottomXAxis(0, NO_OF_X_VALUES, true);
    lineChartYAxisLeft   = createLeftYAxis(0, 20, true);
    lineChartYAxisRight  = createRightYAxis(tempFahrenheitMin, tempFahrenheitMax, false);
    xyChart = new XYChart<>(new XYPane(xySeries1, xySeries2, xySeries3, xySeries4),
                            lineChartYAxisLeft, lineChartYAxisRight, lineChartXAxisBottom);

    // YChart
    List<YChartItem> yItem1 = new ArrayList<>(20);
    List<YChartItem> yItem2 = new ArrayList<>(20);
    List<YChartItem> yItem3 = new ArrayList<>(20);
    for (int i = 0 ; i < 20 ; i++) {
        yItem1.add(new YChartItem(RND.nextDouble() * 100, "P" + i, COLORS[RND.nextInt(3)]));
        yItem2.add(new YChartItem(RND.nextDouble() * 100, "P" + i, COLORS[RND.nextInt(3)]));
        yItem3.add(new YChartItem(RND.nextDouble() * 100, "P" + i, COLORS[RND.nextInt(3)]));
    }

    ySeries1 = new YSeries(yItem1, ChartType.RADAR_SECTOR, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(255, 0, 0, 0.5)), new Stop(0.5, Color.rgb(255, 255, 0, 0.5)), new Stop(1.0, Color.rgb(0, 200, 0, 0.8))), Color.TRANSPARENT);
    ySeries2 = new YSeries(yItem2, ChartType.SMOOTH_RADAR_POLYGON, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(0, 255, 255, 0.5)), new Stop(1.0, Color.rgb(0, 0, 255, 0.5))), Color.TRANSPARENT);
    ySeries3 = new YSeries(yItem3, ChartType.SMOOTH_RADAR_POLYGON, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(255, 255, 0, 0.5)), new Stop(1.0, Color.rgb(255, 0, 255, 0.5))), Color.TRANSPARENT);
    yChart   = new YChart(new YPane(ySeries1, ySeries2, ySeries3));

    lastTimerCall = System.nanoTime();
    timer = new AnimationTimer() {
        @Override public void handle(final long now) {
            if (now > lastTimerCall + UPDATE_INTERVAL) {
                ObservableList<XYChartItem> xyItems = xySeries1.getItems();
                xyItems.forEach(item -> item.setY(RND.nextDouble() * 8 + RND.nextDouble() * 10));

                xyItems = xySeries2.getItems();
                xyItems.forEach(item -> item.setY(RND.nextDouble() * 4 + RND.nextDouble() * 10));

                xyItems = xySeries3.getItems();
                xyItems.forEach(item -> item.setY(RND.nextDouble() * 3 + RND.nextDouble() * 4));

                xyItems = xySeries4.getItems();
                xyItems.forEach(item -> item.setY(RND.nextDouble() * 4));

                ObservableList<YChartItem> yItems = ySeries1.getItems();
                yItems.forEach(item -> item.setY(RND.nextDouble() * 100));

                yItems = ySeries2.getItems();
                yItems.forEach(item -> item.setY(RND.nextDouble() * 100));

                yItems = ySeries3.getItems();
                yItems.forEach(item -> item.setY(RND.nextDouble() * 100));

                // Can be used to update charts but if more than one series is in one xyPane
                // it's easier to use the refresh() method of XYChart
                //xySeries1.refresh();
                //xySeries2.refresh();
                //xySeries3.refresh();
                //xySeries4.refresh();

                // Useful to refresh the chart if it contains more than one series to avoid
                // multiple redraws
                xyChart.refresh();

                //ySeries1.refresh();
                //ySeries2.refresh();

                yChart.refresh();

                lastTimerCall = now;
            }
        }
    };
}
 
Example 17
Source File: Rank.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public Rank(final Ranking RANKING, final Color COLOR) {
    ranking = null == RANKING ? Ranking.NONE : RANKING;
    color   = null == COLOR ? Color.TRANSPARENT : COLOR;
}
 
Example 18
Source File: ChartData.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public ChartData(final String NAME, final double VALUE, final Instant TIMESTAMP, final java.time.Duration DURATION, final Color FILL_COLOR) {
    this(null, NAME, VALUE, FILL_COLOR, Color.TRANSPARENT, Tile.FOREGROUND, TIMESTAMP, DURATION, true, 800);
}
 
Example 19
Source File: Section.java    From tilesfx with Apache License 2.0 2 votes vote down vote up
/**
 * Represents an area of a given range, defined by a start and stop value.
 * This class is used for regions and areas in many gauges. It is possible
 * to check a value against the defined range and fire events in case the
 * value enters or leaves the defined region.
 */
public Section() {
    this(-1, -1, "", null, Color.TRANSPARENT, Color.TRANSPARENT, Color.TRANSPARENT, "");
}
 
Example 20
Source File: Rank.java    From tilesfx with Apache License 2.0 votes vote down vote up
public Rank() { this(Ranking.NONE, Color.TRANSPARENT); }