下面列出了javafx.scene.paint.Color#WHITE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public JavaFXDisplayDriver(int boardSize, int cellSizePx, Board board) {
sz = boardSize;
tilePane.setPrefRows(boardSize);
tilePane.setPrefColumns(boardSize);
Cell[][] g = board.getGrid();
for (int i = 0; i < boardSize; i++) {
for (int j = 0; j < boardSize; j++) {
Color c = g[i][j].getState() ? Color.STEELBLUE : Color.WHITE;
Rectangle r = new Rectangle(cellSizePx, cellSizePx, c);
tilePane.getChildren().add(r);
attachListeners(r, g[i][j]);
}
}
}
private void createTopHighlightBorder() {
Stop[] stops = new Stop[] {
new Stop(0, Color.WHITE),
new Stop(.3, Color.LIGHTGRAY),
new Stop(1, Color.TRANSPARENT)
};
LinearGradient lg1 = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);
topHighlightBorder =
new Border(new BorderStroke(
lg1, null, null, null,
BorderStrokeStyle.SOLID, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE,
CornerRadii.EMPTY,
new BorderWidths( 8.0d ),
null
));
}
/** standard light theme */
public static Theme createLightTheme()
{
Color base = FX.rgb(0xececec);
Theme t = new Theme();
t.affirm = FX.mix(base, Color.LIGHTGREEN, 0.8);
t.base = base;
t.control = FX.rgb(0x666666);
t.destruct = FX.mix(base, Color.MAGENTA, 0.7);
t.focus = FX.rgb(0x48dd48); //FX.rgb(0xff6d00),
t.outline = FX.rgb(0xdddddd);
t.selectedTextBG = FX.rgb(255, 255, 148, 0.7); //Color.rgb(193, 245, 176), //FX.rgb(0xffff00),
t.selectedTextFG = Color.BLACK;
t.textBG = Color.WHITE;
t.textFG = Color.BLACK;
return t;
}
@Override
public void start(Stage stage) throws Exception {
Application.Parameters params = getParameters();
List<String> paramList = params.getUnnamed();
// Check for the existence of a proper API Key
if(paramList.size() < 1 || !paramList.get(0).startsWith("-K")) {
throw new IllegalStateException("Demo must be started with arguments [-K]<your-api-key>");
}
FoxEatsDemoView view = new FoxEatsDemoView(this, params);
Scene scene = new Scene(view, 900, 600, Color.WHITE);
stage.setScene(scene);
stage.show();
Rectangle2D primScreenBounds = Screen.getPrimary(). getVisualBounds();
stage.setX(( primScreenBounds.getWidth() - stage.getWidth()) / 2);
stage.setY(( primScreenBounds.getHeight() - stage.getHeight()) / 4);
}
public TilesFXSeries(final Series<X, Y> SERIES, final Paint COLOR) {
series = SERIES;
stroke = COLOR;
fill = COLOR;
if (null != COLOR) {
symbolBackground = new Background(new BackgroundFill(COLOR, new CornerRadii(5), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(5), new Insets(2)));
legendSymbolFill = COLOR;
}
}
public DebugInfo() {
font = Font.font(20);
fillColor = Color.WHITE;
strokeColor = Color.TRANSPARENT;
x = 10;
y = Game.getInstance().getRender().getHeight() - 50;
}
public MenuButton(String name) {
text = new Text(name);
text.setFont(text.getFont().font(20));
text.setFill(Color.WHITE);
Rectangle bg = new Rectangle(250, 30);
bg.setOpacity(0.6);
bg.setFill(Color.BLACK);
bg.setEffect(new GaussianBlur(3.5));
setAlignment(Pos.CENTER_LEFT);
setRotate(-0.5);
getChildren().addAll(bg, text);
setOnMouseEntered(event -> {
bg.setTranslateX(10);
text.setTranslateX(10);
bg.setFill(Color.WHITE);
text.setFill(Color.BLACK);
});
setOnMouseExited(event -> {
bg.setTranslateX(0);
text.setTranslateX(0);
bg.setFill(Color.BLACK);
text.setFill(Color.WHITE);
});
DropShadow drop = new DropShadow(50, Color.WHITE);
drop.setInput(new Glow());
setOnMousePressed(event -> setEffect(drop));
setOnMouseReleased(event -> setEffect(null));
}
public LevelIndicator() {
font = Game.getInstance().getResouceManager().getFont("Starcraft", 40);
status = ObjectStatus.ANIMATION;
fillColor = Color.WHITE;
strokeColor = Color.TRANSPARENT;
x = Game.getInstance().getWidth() / 2 - 50;
y = 50;
}
private Color[] getSectionColors(final Color LCD_BACKGROUND_COLOR, final Color LCD_FOREGROUND_COLOR) {
double hue = LCD_BACKGROUND_COLOR.getHue();
double sat = LCD_BACKGROUND_COLOR.getSaturation();
Color[] colors;
if (Helper.isMonochrome(LCD_BACKGROUND_COLOR)) {
// Section color is monochrome
colors = new Color[]{
Color.hsb(hue, 0, 0.69),
Color.hsb(hue, 0, 1.0),
Color.hsb(hue, 0, 0.76),
Color.hsb(hue, 0, 0.76),
Color.hsb(hue, sat, 0.69),
Helper.isDark(LCD_BACKGROUND_COLOR) ? Color.WHITE : Color.BLACK,
Helper.isDark(LCD_BACKGROUND_COLOR) ? Color.rgb(255, 255, 255, 0.1) : Color.rgb(0, 0, 0, 0.1)
};
} else {
// Section color is not monochrome
colors = new Color[]{
Color.hsb(hue, sat, 0.69),
Color.hsb(hue, sat, 1.0),
Color.hsb(hue, sat, 0.76),
Color.hsb(hue, sat, 0.76),
Color.hsb(hue, sat, 0.69),
LCD_FOREGROUND_COLOR,
Color.color(LCD_BACKGROUND_COLOR.getRed(), LCD_BACKGROUND_COLOR.getGreen(), LCD_BACKGROUND_COLOR.getBlue(), 0.1)
};
}
return colors;
}
public TilesFXSeries(final Series<X, Y> SERIES, final Paint STROKE, final Paint FILL) {
series = SERIES;
stroke = STROKE;
fill = FILL;
if (null != stroke & null != fill) {
symbolBackground = new Background(new BackgroundFill(STROKE, new CornerRadii(5), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(5), new Insets(2)));
legendSymbolFill = stroke;
}
}
private void initColor() {
final ColorPicker colorPicker = (ColorPicker) getSkinnable();
Color color = colorPicker.getValue();
Color circleColor = color == null ? Color.WHITE : color;
// update picker box color
colorBox.setBackground(new Background(new BackgroundFill(circleColor, new CornerRadii(3), Insets.EMPTY)));
// update label color
displayNode.setTextFill(circleColor.grayscale().getRed() < 0.5 ? Color.valueOf(
"rgba(255, 255, 255, 0.87)") : Color.valueOf("rgba(0, 0, 0, 0.87)"));
if (colorLabelVisible.get()) {
displayNode.setText(JFXNodeUtils.colorToHex(circleColor));
} else {
displayNode.setText("");
}
}
@Override
public void accept(final PainteraBaseView viewer, final Supplier<String> projectDirectory) {
final ObjectProperty<SourceState<?, ?>> rawSourceState = new SimpleObjectProperty<>();
final StringProperty name = new SimpleStringProperty(null);
final ObjectProperty<Color> foregroundColor = new SimpleObjectProperty<>(Color.WHITE);
final ObjectProperty<Color> backgroundColor = new SimpleObjectProperty<>(Color.BLACK);
final DoubleProperty minThreshold = new SimpleDoubleProperty();
final DoubleProperty maxThreshold = new SimpleDoubleProperty();
final Alert dialog = makeDialog(
viewer,
rawSourceState,
name,
foregroundColor,
backgroundColor,
minThreshold,
maxThreshold);
final Optional<ButtonType> returnType = dialog.showAndWait();
if (
Alert.AlertType.CONFIRMATION.equals(dialog.getAlertType())
&& ButtonType.OK.equals(returnType.orElse(ButtonType.CANCEL))) {
try {
final SourceState<?, ?> rawState = rawSourceState.get();
final ThresholdingSourceState thresholdingState = new ThresholdingSourceState(name.get(), rawState);
thresholdingState.colorProperty().setValue(foregroundColor.getValue());
thresholdingState.backgroundColorProperty().setValue(backgroundColor.getValue());
thresholdingState.minProperty().setValue(minThreshold.getValue());
thresholdingState.maxProperty().setValue(maxThreshold.getValue());
viewer.addState(thresholdingState);
} catch (final Exception e) {
LOG.error("Unable to create thresholded raw source", e);
Exceptions.exceptionAlert(Paintera.Constants.NAME, "Unable to create thresholded raw source", e).show();
}
}
}
@Override
public void start(Stage stage) {
JFXListView<Label> list = new JFXListView<>();
for (int i = 0; i < 100; i++) {
list.getItems().add(new Label("Item " + i));
}
list.getStyleClass().add("mylistview");
list.setMaxHeight(3400);
StackPane container = new StackPane(list);
container.setPadding(new Insets(24));
JFXScrollPane pane = new JFXScrollPane();
pane.setContent(container);
JFXButton button = new JFXButton("");
SVGGlyph arrow = new SVGGlyph(0,
"FULLSCREEN",
"M402.746 877.254l-320-320c-24.994-24.992-24.994-65.516 0-90.51l320-320c24.994-24.992 65.516-24.992 90.51 0 24.994 24.994 "
+ "24.994 65.516 0 90.51l-210.746 210.746h613.49c35.346 0 64 28.654 64 64s-28.654 64-64 64h-613.49l210.746 210.746c12.496 "
+ "12.496 18.744 28.876 18.744 45.254s-6.248 32.758-18.744 45.254c-24.994 24.994-65.516 24.994-90.51 0z",
Color.WHITE);
arrow.setSize(20, 16);
button.setGraphic(arrow);
button.setRipplerFill(Color.WHITE);
pane.getTopBar().getChildren().add(button);
Label title = new Label("Title");
pane.getBottomBar().getChildren().add(title);
title.setStyle("-fx-text-fill:WHITE; -fx-font-size: 40;");
JFXScrollPane.smoothScrolling((ScrollPane) pane.getChildren().get(0));
StackPane.setMargin(title, new Insets(0, 0, 0, 80));
StackPane.setAlignment(title, Pos.CENTER_LEFT);
StackPane.setAlignment(button, Pos.CENTER_LEFT);
StackPane.setMargin(button, new Insets(0, 0, 0, 20));
final Scene scene = new Scene(new StackPane(pane), 600, 600, Color.WHITE);
stage.setTitle("JFX ListView Demo ");
stage.setScene(scene);
stage.show();
}
private void initializeButtons() {
SVGGlyph full = new SVGGlyph(0,
"FULLSCREEN",
"M598 214h212v212h-84v-128h-128v-84zM726 726v-128h84v212h-212v-84h128zM214 426v-212h212v84h-128v128h-84zM298 598v128h128v84h-212v-212h84z",
Color.WHITE);
full.setSize(16, 16);
SVGGlyph minus = new SVGGlyph(0,
"MINUS",
"M804.571 420.571v109.714q0 22.857-16 38.857t-38.857 16h-694.857q-22.857 0-38.857-16t-16-38.857v-109.714q0-22.857 16-38.857t38.857-16h694.857q22.857 0 38.857 16t16 38.857z",
Color.WHITE);
minus.setSize(12, 2);
minus.setTranslateY(4);
SVGGlyph resizeMax = new SVGGlyph(0,
"RESIZE_MAX",
"M726 810v-596h-428v596h428zM726 44q34 0 59 25t25 59v768q0 34-25 60t-59 26h-428q-34 0-59-26t-25-60v-768q0-34 25-60t59-26z",
Color.WHITE);
resizeMax.setSize(12, 12);
SVGGlyph resizeMin = new SVGGlyph(0,
"RESIZE_MIN",
"M80.842 943.158v-377.264h565.894v377.264h-565.894zM0 404.21v619.79h727.578v-619.79h-727.578zM377.264 161.684h565.894v377.264h-134.736v80.842h215.578v-619.79h-727.578v323.37h80.842v-161.686z",
Color.WHITE);
resizeMin.setSize(12, 12);
SVGGlyph close = new SVGGlyph(0,
"CLOSE",
"M810 274l-238 238 238 238-60 60-238-238-238 238-60-60 238-238-238-238 60-60 238 238 238-238z",
Color.WHITE);
close.setSize(12, 12);
btnFull = new JFXButton();
btnFull.getStyleClass().add("jfx-decorator-button");
btnFull.setCursor(Cursor.HAND);
btnFull.setOnAction((action) -> primaryStage.setFullScreen(!primaryStage.isFullScreen()));
btnFull.setGraphic(full);
btnFull.setTranslateX(-30);
btnFull.setRipplerFill(Color.WHITE);
btnClose = new JFXButton();
btnClose.getStyleClass().add("jfx-decorator-button");
btnClose.setCursor(Cursor.HAND);
btnClose.setOnAction((action) -> onCloseButtonAction.get().run());
btnClose.setGraphic(close);
btnClose.setRipplerFill(Color.WHITE);
btnMin = new JFXButton();
btnMin.getStyleClass().add("jfx-decorator-button");
btnMin.setCursor(Cursor.HAND);
btnMin.setOnAction((action) -> primaryStage.setIconified(true));
btnMin.setGraphic(minus);
btnMin.setRipplerFill(Color.WHITE);
btnMax = new JFXButton();
btnMax.getStyleClass().add("jfx-decorator-button");
btnMax.setCursor(Cursor.HAND);
btnMax.setRipplerFill(Color.WHITE);
btnMax.setOnAction((action) -> maximize(resizeMin, resizeMax));
btnMax.setGraphic(resizeMax);
}
public Options(final double DEGREES, final double OFFSET, final double RADIUS) {
this(DEGREES, OFFSET, RADIUS, 44, Color.RED, Color.WHITE, Color.WHITE, true, false, false, 0.5, true);
}
public void setSeriesColor(final XYChart.Series<X, Y> SERIES, final Paint COLOR) {
Background symbolBackground = new Background(new BackgroundFill(COLOR, new CornerRadii(5), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(5), new Insets(2)));
setSeriesColor(SERIES, COLOR, COLOR, symbolBackground, COLOR);
}
public TimeSection(final LocalTime START, final LocalTime STOP, final Image ICON, final Color COLOR) {
this(START, STOP, "", ICON, COLOR, COLOR, Color.WHITE, false, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY);
}
public ScoreGadget() {
font = Game.getInstance().getResouceManager().getFont("Starcraft", 20);
fillColor = Color.WHITE;
strokeColor = Color.TRANSPARENT;
verticalSpeed = 0;
}
public static final Color getContrastColor(final Color COLOR) {
return COLOR.getBrightness() > 0.5 ? Color.BLACK : Color.WHITE;
}
@Override
public void accept(PainteraBaseView viewer, Supplier<String> projectDirectory) {
final ObjectProperty<SourceState<?, ?>> labelSourceState = new SimpleObjectProperty<>();
final ObjectProperty<ThresholdingSourceState<?, ?>> thresholdingState = new SimpleObjectProperty<>();
final StringProperty name = new SimpleStringProperty(null);
final ObjectProperty<Color> color = new SimpleObjectProperty<>(Color.WHITE);
final Alert dialog = makeDialog(viewer, labelSourceState, thresholdingState, name, color);
final Optional<ButtonType> returnType = dialog.showAndWait();
if (
Alert.AlertType.CONFIRMATION.equals(dialog.getAlertType())
&& ButtonType.OK.equals(returnType.orElse(ButtonType.CANCEL))) {
try {
final SourceState<?, ?> labelState = labelSourceState.get();
final IntersectingSourceState intersectingState;
if (labelState instanceof ConnectomicsLabelState<?, ?>) {
intersectingState = new IntersectingSourceState(
thresholdingState.get(),
(ConnectomicsLabelState) labelState,
new ARGBCompositeAlphaAdd(),
name.get(),
viewer.getQueue(),
0,
viewer.viewer3D().meshesGroup(),
viewer.viewer3D().viewFrustumProperty(),
viewer.viewer3D().eyeToWorldTransformProperty(),
viewer.viewer3D().meshesEnabledProperty(),
viewer.getMeshManagerExecutorService(),
viewer.getMeshWorkerExecutorService());
} else if (labelState instanceof LabelSourceState<?, ?>) {
intersectingState = new IntersectingSourceState(
thresholdingState.get(),
(LabelSourceState) labelState,
new ARGBCompositeAlphaAdd(),
name.get(),
viewer.getQueue(),
0,
viewer.viewer3D().meshesGroup(),
viewer.viewer3D().viewFrustumProperty(),
viewer.viewer3D().eyeToWorldTransformProperty(),
viewer.viewer3D().meshesEnabledProperty(),
viewer.getMeshManagerExecutorService(),
viewer.getMeshWorkerExecutorService());
} else {
intersectingState = null;
}
if (intersectingState != null) {
intersectingState.converter().setColor(Colors.toARGBType(color.get()));
viewer.addState(intersectingState);
} else {
LOG.error(
"Unable to create intersecting state. Expected a label state of class {} or {} but got {} instead.",
ConnectomicsLabelState.class,
LabelSourceState.class,
labelState);
}
} catch (final Exception e) {
LOG.error("Unable to create intersecting state", e);
Exceptions.exceptionAlert(Paintera.Constants.NAME, "Unable to create intersecting state", e).show();
}
}
}