use of javafx.scene.layout.Background in project blue by kunstmusik.
the class BSBGroupView method updateBorderColor.
private void updateBorderColor() {
label.setBackground(new Background(new BackgroundFill(bsbGroup.getBorderColor(), new CornerRadii(4, 4, 0, 0, false), Insets.EMPTY)));
resizePane.setBorder(new Border(new BorderStroke(bsbGroup.getBorderColor(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
}
use of javafx.scene.layout.Background in project contentment by GeePawHill.
the class MainView method makeViewport.
private Pane makeViewport() {
Pane owner = new Pane();
owner.setPrefSize(1600d, 900d);
Background background = new Background(new BackgroundFill(Color.BLACK, null, null));
owner.setBackground(background);
player.scriptProperty().addListener((p, o, n) -> scriptChanged());
media = new MediaView();
owner.getChildren().add(media);
// non-media background
ScaleListener listener = new ScaleListener(owner, player.context().canvas, media);
owner.widthProperty().addListener(listener);
owner.heightProperty().addListener(listener);
listener.changed(null, 300, 300);
owner.setOnMouseClicked((event) -> mouseClicked(event));
owner.getChildren().add(player.context().canvas);
return owner;
}
use of javafx.scene.layout.Background in project CapsLock by chrootRISCassembler.
the class CharPanelGenerator method generate.
/**
* Generates a panel image form char.
* <p>First, this function converts ch to upper case if ch is lower case.</p>
* <p>Then, this generates javafx's image from ch.And return it.</p>
* You can fix the resolution of image through {@link capslock.CharPanelGenerator#PANEL_IMAGE_SIZE}
* and {@link capslock.CharPanelGenerator#FONT_SIZE}.
* @param ch パネルの生成に使う1文字.
* @param color 背景色.
* @return 生成されたパネル.
*/
static final Image generate(char ch, Color color) {
final Label label = new Label(Character.toString(Character.toUpperCase(ch)));
label.setMinSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
label.setMaxSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
label.setPrefSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
label.setFont(Font.font(FONT_SIZE));
label.setAlignment(Pos.CENTER);
label.setTextFill(Color.WHITE);
label.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
final Scene scene = new Scene(new Group(label));
final WritableImage img = new WritableImage(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
scene.snapshot(img);
return img;
}
use of javafx.scene.layout.Background in project tilesfx by HanSolo.
the class BarChartItem method initGraphics.
// ******************** Initialization ************************************
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);
}
}
nameText = new Text(getName());
nameText.setTextOrigin(VPos.TOP);
valueText = new Text(String.format(locale, formatString, getValue()));
valueText.setTextOrigin(VPos.TOP);
barBackground = new Rectangle();
bar = new Rectangle();
pane = new Pane(nameText, valueText, barBackground, bar);
pane.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
getChildren().setAll(pane);
}
use of javafx.scene.layout.Background in project tilesfx by HanSolo.
the class CalendarTileSkin method drawCells.
private void drawCells() {
List<ChartData> dataList = tile.getChartData();
ZonedDateTime time = tile.getTime();
Locale locale = tile.getLocale();
int day = time.getDayOfMonth();
int startDay = time.withDayOfMonth(1).getDayOfWeek().getValue();
long lastDay = time.range(DAY_OF_MONTH).getMaximum();
Color textColor = tile.getTextColor();
Color bkgColor = tile.getBackgroundColor();
Font regFont = Fonts.latoRegular(size * 0.045);
Font bldFont = Fonts.latoBold(size * 0.045);
Background bkgToday = new Background(new BackgroundFill(tile.getBarColor(), new CornerRadii(size * 0.0125), new Insets(2)));
Border appmntBorder = new Border(new BorderStroke(tile.getAlarmColor(), tile.getAlarmColor(), tile.getAlarmColor(), tile.getAlarmColor(), BorderStrokeStyle.SOLID, BorderStrokeStyle.SOLID, BorderStrokeStyle.SOLID, BorderStrokeStyle.SOLID, new CornerRadii(size * 0.0125), BorderWidths.DEFAULT, new Insets(1)));
boolean counting = false;
int dayCounter = 1;
for (int y = 0; y < 7; y++) {
for (int x = 0; x < 8; x++) {
int index = y * 8 + x;
Label label = labels.get(index);
String text;
if (x == 0 && y == 0) {
text = "";
label.setManaged(false);
label.setVisible(false);
} else if (y == 0) {
text = DayOfWeek.of(x).getDisplayName(TextStyle.SHORT, locale);
// label.setTextFill(x == 7 ? Tile.RED : textColor);
label.setTextFill(textColor);
label.setFont(bldFont);
} else if (x == 0) {
text = Integer.toString(time.withDayOfMonth(1).plusDays((y - 1) * 7).get(IsoFields.WEEK_OF_WEEK_BASED_YEAR));
label.setTextFill(Tile.GRAY);
label.setFont(regFont);
label.setBorder(weekBorder);
} else {
if (index - 7 > startDay) {
counting = true;
text = Integer.toString(dayCounter);
LocalDate currentDay = time.toLocalDate().plusDays(dayCounter - 1);
long appointments = dataList.stream().filter(data -> data.getTimestampAsLocalDate().isEqual(currentDay)).count();
if (x == 7) {
if (appointments > 0) {
label.setBorder(appmntBorder);
} else {
label.setBorder(null);
}
label.setTextFill(Tile.RED);
label.setFont(regFont);
} else if (dayCounter == day) {
if (appointments > 0) {
label.setBorder(appmntBorder);
} else {
label.setBorder(null);
}
label.setBackground(bkgToday);
label.setTextFill(bkgColor);
label.setFont(bldFont);
} else {
if (appointments > 0) {
label.setBorder(appmntBorder);
} else {
label.setBorder(null);
}
label.setTextFill(textColor);
label.setFont(regFont);
}
} else {
text = "";
label.setManaged(false);
label.setVisible(false);
}
if (dayCounter > lastDay) {
text = "";
label.setManaged(false);
label.setVisible(false);
}
if (counting) {
dayCounter++;
}
}
label.setText(text);
label.setVisible(true);
label.setManaged(true);
label.setPrefSize(cellWidth, cellHeight);
label.relocate(x * cellWidth + cellOffsetX, y * cellHeight + cellOffsetY);
}
}
}
Aggregations