use of javafx.scene.layout.Background in project Smartcity-Smarthouse by TechnionYP5777.
the class TempDashboard method start.
@Override
public void start(Stage stage) throws Exception {
pane = new FlowPane(Orientation.HORIZONTAL, 1, 1, textTile);
pane.setPadding(new Insets(5));
pane.setPrefSize(150, 150);
pane.setBackground(new Background(new BackgroundFill(Tile.BACKGROUND.darker(), CornerRadii.EMPTY, Insets.EMPTY)));
Scene scene = new Scene(pane);
stage.setTitle("Dashboard Configuration in Action");
stage.setScene(scene);
stage.show();
}
use of javafx.scene.layout.Background in project Smartcity-Smarthouse by TechnionYP5777.
the class ConfigurationController method initialize.
@Override
public void initialize(URL location, ResourceBundle resources) {
button.setOnMouseClicked(e -> {
if (callback != null)
Platform.runLater(callback);
timers.values().stream().filter(l -> l != null).flatMap(l -> l.stream()).forEach(t -> t.stop());
((Stage) button.getScene().getWindow()).close();
widgets.values().stream().filter(l -> l != null).flatMap(l -> l.stream()).forEach(w -> w.getTile().setForegroundBaseColor(normalTileColor));
});
pane.setPadding(new Insets(5));
pane.setBackground(new Background(new BackgroundFill(Tile.BACKGROUND.darker(), CornerRadii.EMPTY, Insets.EMPTY)));
types.setItems(FXCollections.observableArrayList(widgets.keySet()));
types.getSelectionModel().selectedItemProperty().addListener((options, oldValue, newValue) -> {
Optional.ofNullable(timers.get(newValue)).ifPresent(l -> l.stream().forEach(t -> t.start()));
pane.getChildren().setAll(widgets.get(newValue).stream().map(BasicWidget::getTile).collect(Collectors.toList()));
Optional.ofNullable(timers.get(oldValue)).ifPresent(l -> l.stream().forEach(t -> t.stop()));
Optional.ofNullable(widgets.get(oldValue)).ifPresent(l -> l.stream().forEach(w -> w.getTile().setForegroundBaseColor(normalTileColor)));
});
types.getSelectionModel().select(3);
;
// sPane.setHbarPolicy(ScrollBarPolicy.ALWAYS);
// sPane.setVbarPolicy(ScrollBarPolicy.NEVER);
// sPane.setContent(pane);
}
use of javafx.scene.layout.Background in project aima-java by aimacode.
the class NQueensViewCtrl method update.
/** Updates the view. */
public void update(NQueensBoard board) {
int size = board.getSize();
if (queens.length != size * size) {
gridPane.getChildren().clear();
gridPane.getColumnConstraints().clear();
gridPane.getRowConstraints().clear();
queens = new Polygon[size * size];
RowConstraints c1 = new RowConstraints();
c1.setPercentHeight(100.0 / size);
ColumnConstraints c2 = new ColumnConstraints();
c2.setPercentWidth(100.0 / size);
for (int i = 0; i < board.getSize(); i++) {
gridPane.getRowConstraints().add(c1);
gridPane.getColumnConstraints().add(c2);
}
for (int i = 0; i < queens.length; i++) {
StackPane field = new StackPane();
queens[i] = createQueen();
field.getChildren().add(queens[i]);
int col = i % size;
int row = i / size;
field.setBackground(new Background(new BackgroundFill((col % 2 == row % 2) ? Color.WHITE : Color.LIGHTGRAY, null, null)));
gridPane.add(field, col, row);
}
}
double scale = 0.2 * gridPane.getWidth() / gridPane.getColumnConstraints().size();
for (int i = 0; i < queens.length; i++) {
Polygon queen = queens[i];
queen.setScaleX(scale);
queen.setScaleY(scale);
XYLocation loc = new XYLocation(i % size, i / size);
if (board.queenExistsAt(loc)) {
queen.setVisible(true);
queen.setFill(board.isSquareUnderAttack(loc) ? Color.RED : Color.BLACK);
} else {
queen.setVisible(false);
}
}
}
use of javafx.scene.layout.Background in project Gargoyle by callakrsos.
the class SkinPreviewViewComposite method previewTabInit.
@FxPostInitialize
public void previewTabInit() {
Task<Void> task = new Task<Void>() {
@Override
protected Void call() throws Exception {
Thread.sleep(5000L);
Platform.runLater(() -> {
//메뉴바 배경.
{
Background background = mbSample.getBackground();
Color fill = (Color) background.getFills().get(0).getFill();
colorMbSample.setValue(fill);
//메뉴바 텍스트
{
Label lookup = (Label) mbSample.lookup(".label");
Color textFill = (Color) lookup.getTextFill();
colorMbLabelSample.setValue(textFill);
}
}
//Hbox 배경.
{
Background background = hboxSample.getBackground();
Color fill = (Color) background.getFills().get(0).getFill();
colorHboxSample.setValue(fill);
}
{
//선택디지않는 탭 색상 처리.
Set<Node> lookupAll = tabpaneSample.lookupAll(".tab:top");
lookupAll.forEach(lookup -> {
Optional<PseudoClass> findFirst = lookup.getPseudoClassStates().stream().filter(v -> {
return "selected".equals(v.getPseudoClassName());
}).findFirst();
if (findFirst.isPresent()) {
Label selectedTabLabel = (Label) lookup.lookup(".tab-label");
Color textFill = (Color) selectedTabLabel.getTextFill();
colorSelectedTabText.setValue(textFill);
} else {
Label selectedTabLabel = (Label) lookup.lookup(".tab-label");
Color textFill = (Color) selectedTabLabel.getTextFill();
colorUnSelectedTabText.setValue(textFill);
}
});
{
lookupAll.stream().findFirst().ifPresent(n -> {
Pane p = (Pane) n;
Background background = p.getBackground();
Color fill = (Color) background.getFills().get(0).getFill();
colorTabSample1Selected.setValue(fill);
});
}
}
});
return null;
}
};
Window window = this.getScene().getWindow();
if (window != null) {
FxUtil.showLoading(window, task);
} else
FxUtil.showLoading(task);
}
use of javafx.scene.layout.Background in project PretendYoureXyzzyReborn by devgianlu.
the class PyxCard method initialize.
@FXML
public void initialize() {
this.text.setText(card.text);
this.watermark.setText(card.watermark);
if (card instanceof BlackCard) {
// Black card
setBackground(new Background(new BackgroundFill(Color.BLACK, new CornerRadii(8), Insets.EMPTY)));
this.text.setTextFill(Color.WHITE);
this.watermark.setTextFill(Color.WHITE);
} else {
// White card
setBackground(new Background(new BackgroundFill(Color.WHITE, new CornerRadii(8), Insets.EMPTY)));
this.text.setTextFill(Color.BLACK);
this.watermark.setTextFill(Color.BLACK);
}
}
Aggregations