use of javafx.scene.layout.Background in project TeachingInSimulation by ScOrPiOzzy.
the class SVGGlyph method init.
// public SVGGlyph(String svgPathContent) {
// this(-1, "UNNAMED", svgPathContent, Color.BLACK);
// }
// public SVGGlyph(String svgPathContent, Paint fill) {
// this(-1, "UNNAMED", svgPathContent, fill);
// }
// /**
// * Constructs SVGGlyph node for a specified svg content and color <b>Note:</b> name and glyphId is not needed when creating a single SVG image, they have been used in {@link SVGHelper} to load icomoon svg font.
// * @param glyphId integer represents the glyph id
// * @param name glyph name
// * @param svgPathContent svg content
// * @param fill svg color
// */
// public SVGGlyph(int glyphId, String name, String svgPathContent, Paint fill) {
// this.glyphId = glyphId;
// this.name.set(name);
// init(svgPathContent, fill);
// }
private void init(String svgPathContent, Paint fill) {
getStyleClass().add(DEFAULT_STYLE_CLASS);
this.fill.addListener((observable) -> setBackground(new Background(new BackgroundFill(getFill() == null ? Color.BLACK : getFill(), null, null))));
shapeProperty().addListener(observable -> {
Shape shape = getShape();
if (getShape() != null) {
widthHeightRatio = shape.prefWidth(-1) / shape.prefHeight(-1);
if (getSize() != Region.USE_COMPUTED_SIZE) {
setSizeRatio(getSize());
}
}
});
SVGPath shape = new SVGPath();
shape.setContent(svgPathContent);
setShape(shape);
setFill(fill);
setPrefSize(DEFAULT_PREF_SIZE, DEFAULT_PREF_SIZE);
getTransforms().add(new Scale(1, -1));
Translate height = new Translate();
height.yProperty().bind(Bindings.createDoubleBinding(() -> -this.getHeight(), this.heightProperty()));
getTransforms().add(height);
}
use of javafx.scene.layout.Background in project Smartcity-Smarthouse by TechnionYP5777.
the class DashboardController method initialize.
/*
* (non-Javadoc)
*
* @see il.ac.technion.cs.smarthouse.gui.controllers.SystemGuiController#
* initialize(il.ac.technion.cs.smarthouse.system.SystemCore,
* il.ac.technion.cs.smarthouse.gui_controller.GuiController,
* il.ac.technion.cs.smarthouse.system.SystemMode, java.net.URL,
* java.util.ResourceBundle)
*/
@Override
protected <T extends GuiController<SystemCore>> void initialize(final SystemCore model1, final T parent1, final SystemMode extraData1, final URL location, final ResourceBundle b) {
filesystem = model1.getFileSystem();
core = model1.getSystemDashboardCore();
core.setWidgetPresenter(this::addWidget);
core.setWidgetRemover(this::removeWidget);
final Label plus = new Label("+");
plus.setFont(Font.font("Arial Black", FontWeight.EXTRA_BOLD, 70));
plus.setTextFill(Color.ANTIQUEWHITE);
addWidgetTile = TileBuilder.create().prefSize(TILE_SIZE, TILE_SIZE).skinType(SkinType.CUSTOM).graphic(plus).build();
Tooltip addTooltip = new Tooltip("Click to add a widget");
addTooltip.setStyle("-fx-font: System 12");
addWidgetTile.setTooltip(addTooltip);
addWidgetTile.setOnMouseClicked(e -> openConfigWindow());
pane.setBackground(new Background(new BackgroundFill(Tile.BACKGROUND.darker(), null, null)));
pane.setPrefSize(3000, 3000);
pane.setPadding(new Insets(5));
pane.getChildren().add(addWidgetTile);
}
use of javafx.scene.layout.Background in project tilesfx by HanSolo.
the class Demo method start.
@Override
public void start(Stage stage) {
FlowGridPane pane = new FlowGridPane(8, 5, 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, ephemerisTile, characterTile, flipTile, switchSliderTile, dateTile, calendarTile, sunburstTile, matrixTile, // , weatherTile);
radialPercentageTile);
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(10);
Scene scene = new Scene(pane);
scene.setCamera(camera);
stage.setTitle("TilesFX");
stage.setScene(scene);
stage.show();
// Calculate number of nodes
calcNoOfNodes(pane);
System.out.println(noOfNodes + " Nodes in SceneGraph");
timer.start();
mapTile.addPoiLocation(new Location(51.85, 7.75, "Test"));
mapTile.removePoiLocation(new Location(51.85, 7.75, "Test"));
radialPercentageTile.showNotifier(true);
}
use of javafx.scene.layout.Background in project tilesfx by HanSolo.
the class TileSkin method redraw.
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();
}
use of javafx.scene.layout.Background in project tilesfx by HanSolo.
the class TileSkin method initGraphics.
// ******************** Initialization ************************************
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);
}
Aggregations