use of javafx.scene.layout.BackgroundFill in project JFoenix by jfoenixadmin.
the class JFXComboBox method defaultNodeConverter.
private static <T> NodeConverter<T> defaultNodeConverter() {
return new NodeConverter<T>() {
@Override
public Node toNode(T object) {
if (object == null)
return null;
StackPane selectedValueContainer = new StackPane();
selectedValueContainer.getStyleClass().add("combo-box-selected-value-container");
selectedValueContainer.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, null, null)));
Label selectedValueLabel;
if (object instanceof Label)
selectedValueLabel = new Label(((Label) object).getText());
else
selectedValueLabel = new Label(object.toString());
selectedValueLabel.setTextFill(Color.BLACK);
selectedValueContainer.getChildren().add(selectedValueLabel);
StackPane.setAlignment(selectedValueLabel, Pos.CENTER_LEFT);
StackPane.setMargin(selectedValueLabel, new Insets(0, 0, 0, 5));
return selectedValueContainer;
}
@SuppressWarnings("unchecked")
@Override
public T fromNode(Node node) {
return (T) node;
}
@Override
public String toString(T object) {
if (object == null)
return null;
if (object instanceof Label)
return ((Label) object).getText();
return object.toString();
}
};
}
use of javafx.scene.layout.BackgroundFill in project JFoenix by jfoenixadmin.
the class JFXFillTransition method interpolate.
/**
* {@inheritDoc}
*/
@Override
protected void interpolate(double frac) {
if (start == null)
starting();
Color newColor = start.interpolate(end, frac);
if (Color.TRANSPARENT.equals(start))
newColor = new Color(end.getRed(), end.getGreen(), end.getBlue(), newColor.getOpacity());
region.get().setBackground(new Background(new BackgroundFill(newColor, radii, insets)));
}
use of javafx.scene.layout.BackgroundFill in project Retrospector by NonlinearFruit.
the class Retrospector method init.
@Override
public void init() {
ImageView splash = new ImageView(new Image(SPLASH_IMAGE, SPLASH_WIDTH, SPLASH_HEIGHT, true, true));
loadProgress = new ProgressBar(0);
loadProgress.setPrefWidth(SPLASH_WIDTH);
progressText = new Label("Initializing . . .");
progressText.setBackground(new Background(new BackgroundFill(Color.GHOSTWHITE, new CornerRadii(5), new Insets(0))));
splashLayout = new VBox();
splashLayout.getChildren().addAll(splash, loadProgress, progressText);
progressText.setAlignment(Pos.CENTER);
// splashLayout.setEffect(new DropShadow());
splashLayout.setBackground(Background.EMPTY);
}
use of javafx.scene.layout.BackgroundFill in project Smartcity-Smarthouse by TechnionYP5777.
the class Controller method initialize.
@Override
public void initialize(final URL location, final ResourceBundle __) {
pane.setPrefSize(1200, 800);
List<Tile> tiles = new ArrayList<>();
for (int i = 0; i < ROWS_NUM * TILES_IN_ROW; ++i) {
final Integer loc = i;
final Tile t = TileBuilder.create().prefSize(TILE_SIZE, TILE_SIZE).skinType(SkinType.TEXT).description("Choose a widget:\nClick me!\t\t").descriptionAlignment(Pos.CENTER).textVisible(true).build();
setTileEventHandlers(t, loc);
tiles.add(t);
}
pane.getChildren().addAll(tiles);
pane.setBackground(new Background(new BackgroundFill(Tile.BACKGROUND.darker(), null, null)));
// pane.setPadding(new Insets(5));
// pane.setPrefHeight((TILE_SIZE+8)*ROWS_NUM);
// pane.setPrefWidth((TILE_SIZE+8)*TILES_IN_ROW);
}
use of javafx.scene.layout.BackgroundFill in project Gargoyle by callakrsos.
the class ColorAnalysisExam method start.
/*
* (non-Javadoc)
*
* @see javafx.application.Application#start(javafx.stage.Stage)
*/
@Override
public void start(Stage primaryStage) throws Exception {
BorderPane root = new BorderPane();
ColorPicker value = new ColorPicker();
root.setTop(value);
List<Label> arrayList = new ArrayList<>();
for (int i = 0; i < 7; i++) {
Label region = new Label();
region.setPrefWidth(100);
region.setPrefHeight(100);
String text = "";
switch(i) {
case 0:
text = "Default";
break;
case 1:
text = "Brigher";
break;
case 2:
text = "darker";
break;
case 3:
text = "desaturate";
break;
case 4:
text = "grayscale";
break;
case 5:
text = "invert";
break;
case 6:
text = "saturate";
break;
}
region.setText(text);
arrayList.add(region);
}
Region region2 = new Region();
region2.setPrefWidth(100);
region2.setPrefHeight(100);
value.valueProperty().addListener((oba, o, n) -> {
arrayList.get(0).setBackground(new Background(new BackgroundFill(n, CornerRadii.EMPTY, new Insets(0))));
arrayList.get(1).setBackground(new Background(new BackgroundFill(n.brighter(), CornerRadii.EMPTY, new Insets(0))));
arrayList.get(2).setBackground(new Background(new BackgroundFill(n.darker(), CornerRadii.EMPTY, new Insets(0))));
arrayList.get(3).setBackground(new Background(new BackgroundFill(n.desaturate(), CornerRadii.EMPTY, new Insets(0))));
arrayList.get(4).setBackground(new Background(new BackgroundFill(n.grayscale(), CornerRadii.EMPTY, new Insets(0))));
arrayList.get(5).setBackground(new Background(new BackgroundFill(n.invert(), CornerRadii.EMPTY, new Insets(0))));
arrayList.get(6).setBackground(new Background(new BackgroundFill(n.saturate(), CornerRadii.EMPTY, new Insets(0))));
});
HBox value2 = new HBox();
value2.getChildren().addAll(arrayList);
root.setCenter(value2);
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
Aggregations