Java Code Examples for javafx.scene.layout.BackgroundFill

The following examples show how to use javafx.scene.layout.BackgroundFill. 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: ClientDisplay.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param message Displays a message in the status bar with normal status
 */
public void updateStatusBar(String message) {
	Date date = new Date();
	String output = "" + sdf.format(date) + " " + message;
	logger.info(output);
	Platform.runLater(new Thread() {
		@Override
		public void run() {

			try {
				statuslabel.setBackground(
						new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));

				statuslabel.setText(output);
			} catch (Exception e) {
				logger.warning("Exception in setting status bar " + e.getMessage());
				for (int i = 0; i < e.getStackTrace().length; i++) {
					String element = e.getStackTrace()[i].toString();
					if (element.startsWith("org.openlowcode"))
						logger.warning(e.getStackTrace()[i].toString());
				}
			}
		}
	});

}
 
Example 3
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 4
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 5
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 6
Source Project: JFoenix   Source File: JFXTextAreaSkinAndroid.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 7
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 8
Source Project: Medusa   Source File: LevelSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    locale       = gauge.getLocale();
    formatString = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f%%").toString();

    // Background stroke and fill
    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)));

    fluidBody.setFill(gauge.getBarColor());
    fluidTop.setFill(gauge.getBarColor().darker());

    valueText.setFill(gauge.getValueColor());
    titleText.setFill(gauge.getTitleColor());
    resizeText();

    setBar(gauge.getCurrentValue());
}
 
Example 9
Source Project: LogFX   Source File: LogLine.java    License: GNU General Public License v3.0 6 votes vote down vote up
BackgroundTransition( Color targetColor ) {
    List<BackgroundFill> fills = getBackground().getFills();
    if ( !fills.isEmpty() && fills.get( 0 ).getFill() instanceof Color ) {
        this.originalColor = ( Color ) fills.get( 0 ).getFill();
    } else {
        this.originalColor = targetColor.invert();
    }

    if ( targetColor.equals( originalColor ) ) {
        this.targetColor = targetColor.invert();
    } else {
        this.targetColor = targetColor;
    }

    setCycleDuration( Duration.millis( 650 ) );
    setInterpolator( Interpolator.EASE_OUT );
    setCycleCount( 6 );
    setAutoReverse( true );
    setOnFinished( event -> setBackground( FxUtils.simpleBackground( originalColor ) ) );
}
 
Example 10
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 11
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 12
Source Project: Medusa   Source File: ChargeSkin.java    License: Apache License 2.0 6 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);
        }
    }

    for (int i = 0 ; i < 12 ; i++) {
        Region bar = new Region();
        bar.setPrefSize(20, 20 + (i * 4));
        bars[i] = bar;
    }

    pane = new HBox(bars);
    pane.setSpacing(PREFERRED_WIDTH * 0.01960784);
    pane.setAlignment(Pos.BOTTOM_CENTER);
    pane.setFillHeight(false);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(borderWidth))));

    getChildren().setAll(pane);
}
 
Example 13
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 14
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 15
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 16
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 17
Source Project: medusademo   Source File: TemplateGaugeSkin.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(1))));
    pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

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

    textColor  = clock.getTextColor();
    dateColor  = clock.getDateColor();
    alarmColor = clock.getAlarmColor();

    drawTime(time);
}
 
Example 19
Source Project: tilesfx   Source File: SunburstChart.java    License: Apache License 2.0 5 votes vote down vote up
public 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 20
Source Project: JFoenix   Source File: JFXToggleNodeSkin.java    License: 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 21
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 22
Source Project: img2latex-mathpix   Source File: CopiedButton.java    License: Apache License 2.0 5 votes vote down vote up
public CopiedButton() {

        setText("COPIED");
        setPrefHeight(20);
        // white text colour
        setTextFill(Color.WHITE);
        setFont(Font.font("Arial Black", FontWeight.BOLD, 10));
        // blue background
        setBackground(new Background(new BackgroundFill(UIUtils.LIGHT_BLUE, RADII, Insets.EMPTY)));

    }
 
Example 23
Source Project: chart-fx   Source File: ToolBarFlowPane.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param chart the associated chart pane
 */
public ToolBarFlowPane(final Chart chart) {
    super();
    this.chart = chart;

    this.setId(this.getClass().getSimpleName() + "(Chart)"); // N.B. not a unique name but for testing this suffices
    StackPane.setAlignment(this, Pos.TOP_CENTER);
    this.setPrefHeight(USE_COMPUTED_SIZE);
    this.setBackground(new Background(new BackgroundFill(defaultColour, CornerRadii.EMPTY, Insets.EMPTY)));
    this.setMinHeight(0);

    this.setShape(ToolBarShapeHelper.getToolBarShape(this.getWidth(), this.getHeight(), cornerRadius.get()));

    this.setAlignment(Pos.TOP_CENTER);
    this.setMinWidth(0);
    setPadding(calculateInsets()); // NOPMD
    HBox.setHgrow(this, Priority.NEVER);

    ChangeListener<Number> toolBarSizeListener = (ch, o, n) -> {
        if (n.equals(o)) {
            return;
        }
        adjustToolBarWidth();
    };

    this.widthProperty().addListener(toolBarSizeListener);
    this.heightProperty().addListener(toolBarSizeListener);
    chart.getCanvas().widthProperty().addListener(toolBarSizeListener);
    cornerRadius.addListener(toolBarSizeListener);
}
 
Example 24
@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 25
Source Project: PDF4Teachers   Source File: GradeTreeView.java    License: Apache License 2.0 5 votes vote down vote up
public GradeTreeView(LBGradeTab gradeTab){

        disableProperty().bind(MainWindow.mainScreen.statusProperty().isNotEqualTo(MainScreen.Status.OPEN));
        setBackground(new Background(new BackgroundFill(Color.rgb(244, 244, 244), CornerRadii.EMPTY, Insets.EMPTY)));
        prefHeightProperty().bind(gradeTab.pane.heightProperty().subtract(layoutYProperty()));
        prefWidthProperty().bind(gradeTab.pane.widthProperty());

        setCellFactory(new Callback<>() {
            @Override
            public TreeCell<String> call(TreeView<String> param) {
                return new TreeCell<>() {
                    @Override protected void updateItem(String item, boolean empty){
                        super.updateItem(item, empty);

                        // Enpty cell or String Data
                        if(empty || item != null){
                            setGraphic(null);
                            setStyle(null);
                            setContextMenu(null);
                            setOnMouseClicked(null);
                            setTooltip(null);
                            return;
                        }
                        // TreeGradeData
                        if(getTreeItem() instanceof GradeTreeItem){
                            ((GradeTreeItem) getTreeItem()).updateCell(this);
                            return;
                        }
                        // Other
                        setStyle(null);
                        setGraphic(null);
                        setContextMenu(null);
                        setOnMouseClicked(null);
                        setTooltip(null);
                    }
                };
            }
        });
    }
 
Example 26
Source Project: medusademo   Source File: PollenDashboard.java    License: Apache License 2.0 5 votes vote down vote up
@Override public void init() {
    GaugeBuilder builder = GaugeBuilder.create()
                                       .skinType(SkinType.INDICATOR)
                                       .prefWidth(150)
                                       .animated(true)
                                       .decimals(0)
                                       .sectionsVisible(true)
                                       .sections(new Section(0, 33, Color.rgb(34, 180, 11)),
                                                 new Section(33, 66, Color.rgb(255, 146, 0)),
                                                 new Section(66, 100, Color.rgb(255, 0, 39)));
    ragweed  = builder.build();
    birch    = builder.build();
    grass    = builder.build();
    olive    = builder.build();
    combined = builder.build();

    HBox ragweedBox  = getHBox("RAGWEED", ragweed);
    HBox birchBox    = getHBox("BIRCH", birch);
    HBox grassBox    = getHBox("GRASS", grass);
    HBox oliveBox    = getHBox("OLIVE", olive);
    HBox combinedBox = getHBox("COMBINED", combined);

    pane = new VBox(ragweedBox, new Separator(Orientation.HORIZONTAL),
                    birchBox, new Separator(Orientation.HORIZONTAL),
                    grassBox, new Separator(Orientation.HORIZONTAL),
                    oliveBox, new Separator(Orientation.HORIZONTAL),
                    combinedBox);
    pane.setPadding(new Insets(20, 20, 0, 20));
    pane.setSpacing(10);
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(242, 242, 242), CornerRadii.EMPTY, Insets.EMPTY)));
}
 
Example 27
Source Project: Medusa   Source File: BulletChartSkin.java    License: Apache License 2.0 5 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()))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
    drawTickMarks(tickMarksCtx);
    drawSections(sectionsCtx);
    thresholdRect.setFill(gauge.getThresholdColor());
    thresholdTooltip.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getThreshold()));
    barRect.setFill(gauge.getBarColor());
    enableNode(titleText, true);
    titleText.setFill(gauge.getTitleColor());
    unitText.setFill(gauge.getUnitColor());
    updateBar();
}
 
Example 28
Source Project: mars-sim   Source File: DotMatrixDemo.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(matrix);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(20, 20, 20), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("DotMatrix");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example 29
Source Project: mars-sim   Source File: TilesFxDemo.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
	FlowGridPane pane = new FlowGridPane(7, 4, percentageTile, clockTile, gaugeTile, sparkLineTile, areaChartTile,
			lineChartTile, timerControlTile, numberTile, textTile, highLowTile, plusMinusTile, sliderTile,
			switchTile, timeTile, barChartTile, customTile, leaderBoardTile, worldTile, mapTile, radialChartTile,
			donutChartTile, circularProgressTile, stockTile, gaugeSparkLineTile, radarChartTile1, radarChartTile2,
			smoothAreaChartTile, countryTile, flipTile);// , weatherTile);

	pane.setHgap(5);
	pane.setVgap(5);
	pane.setAlignment(Pos.CENTER);
	pane.setCenterShape(true);
	pane.setPadding(new Insets(5));
	// pane.setPrefSize(800, 600);
	pane.setBackground(new Background(new BackgroundFill(Color.web("#101214"), CornerRadii.EMPTY, Insets.EMPTY)));

	PerspectiveCamera camera = new PerspectiveCamera();
	camera.setFieldOfView(7);
	
	Scene scene = new Scene(pane);
	scene.setCamera(camera);
	
	stage.setTitle("TilesFX");
	stage.setScene(scene);
	stage.show();

	timer.start();

	mapTile.addPoiLocation(new Location(51.85, 7.75, "Test"));
	mapTile.removePoiLocation(new Location(51.85, 7.75, "Test"));
}
 
Example 30
Source Project: medusademo   Source File: ActivityDashboard.java    License: Apache License 2.0 5 votes vote down vote up
@Override public void init() {
    GaugeBuilder builder = GaugeBuilder.create()
                                       .skinType(SkinType.SLIM)
                                       .barBackgroundColor(MaterialDesign.GREY_800.get())
                                       .animated(true)
                                       .animationDuration(1000);
    steps        = builder.decimals(0).maxValue(10000).unit("STEPS").build();
    distance     = builder.decimals(2).maxValue(10).unit("KM").build();
    actvCalories = builder.decimals(0).maxValue(2200).unit("KCAL").build();
    foodCalories = builder.decimals(0).maxValue(2200).unit("KCAL").build();
    weight       = builder.decimals(1).maxValue(85).unit("KG").build();
    bodyFat      = builder.decimals(1).maxValue(20).unit("%").build();

    VBox stepsBox        = getVBox("STEPS", MaterialDesign.CYAN_300.get(), steps);
    VBox distanceBox     = getVBox("DISTANCE", MaterialDesign.ORANGE_300.get(), distance);
    VBox actvCaloriesBox = getVBox("ACTIVE CALORIES", MaterialDesign.RED_300.get(), actvCalories);
    VBox foodCaloriesBox = getVBox("FOOD", MaterialDesign.GREEN_300.get(), foodCalories);
    VBox weightBox       = getVBox("WEIGHT", MaterialDesign.DEEP_PURPLE_300.get(), weight);
    VBox bodyFatBox      = getVBox("BODY FAT", MaterialDesign.PURPLE_300.get(), bodyFat);

    pane = new GridPane();
    pane.setPadding(new Insets(20));
    pane.setHgap(10);
    pane.setVgap(15);
    pane.setBackground(new Background(new BackgroundFill(MaterialDesign.GREY_900.get(), CornerRadii.EMPTY, Insets.EMPTY)));
    pane.add(stepsBox, 0, 0);
    pane.add(distanceBox, 1, 0);
    pane.add(actvCaloriesBox, 0, 2);
    pane.add(foodCaloriesBox, 1, 2);
    pane.add(weightBox, 0, 4);
    pane.add(bodyFatBox, 1, 4);
}