下面列出了javafx.scene.paint.Color#BLUE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public Car(final String NAME, final String VENDOR, final String MODEL) {
this.NAME = NAME;
this.VENDOR = VENDOR;
this.MODEL = MODEL;
cylinder = new ChartItem("Cylinder");
power = new ChartItem("Power");
acceleration = new ChartItem("Acceleration");
weight = new ChartItem("Weight");
consumption = new ChartItem("Consumption");
properties = new HashMap<>();
properties.put(cylinder.getName(), cylinder);
properties.put(power.getName(), power);
properties.put(acceleration.getName(), acceleration);
properties.put(weight.getName(), weight);
properties.put(consumption.getName(), consumption);
fill = Color.TRANSPARENT;
stroke = Color.BLUE;
}
@Spawns("player")
public Entity newPlayer(SpawnData data) {
var top = new Rectangle(60, 20, Color.BLUE);
top.setStroke(Color.GRAY);
var body = new Rectangle(25, 60, Color.BLUE);
body.setStroke(Color.GRAY);
var bot = new Rectangle(60, 20, Color.BLUE);
bot.setStroke(Color.GRAY);
bot.setTranslateY(40);
return entityBuilder()
.type(PLAYER)
.from(data)
.view(body)
.view(top)
.view(bot)
.build();
}
public static Color createColor(final String name) {
switch (name) {
case "black":
return Color.BLACK;
case "blue":
return Color.BLUE;
case "brown":
return Color.SADDLEBROWN;
case "gray":
return DARK_GRAY;
case "green":
return Color.GREEN;
case "orange":
return Color.ORANGE;
case "red":
return Color.RED;
case "white":
return Color.WHITE;
default:
if (name.startsWith("#")) {
try {
return Color.web(name);
} catch (IllegalArgumentException e) {
return Color.CORNSILK;
}
} else {
return Color.CORNSILK;
}
}
}
private void grow() {
moveFood();
Cube cube = new Cube(Color.BLUE);
cube.set(next.add(dir));
snake.getChildren().add(cube);
}
public ParallelCoordinatesChart() {
_axisColor = Color.BLACK;
_headerColor = Color.BLACK;
_unitColor = Color.BLACK;
_tickLabelColor = Color.BLACK;
_locale = Locale.US;
_decimals = 0;
_tickMarksVisible = true;
_selectedColor = Color.BLUE;
_unselectedColor = Color.LIGHTGRAY;
_selectionRectColor = Color.BLUE;
_smoothConnections = false;
selectionRectCategory = "";
formatString = new StringBuilder("%.").append(_decimals).append("f").toString();
selectedItems = new HashMap<>();
selectedObjects = new LinkedHashSet<>();
selectionRect = new CtxBounds();
items = FXCollections.observableArrayList();
itemListener = e -> redraw();
objectListListener = c -> {
while (c.next()) {
if (c.wasAdded()) {
c.getAddedSubList().forEach(addedObject -> addedObject.getProperties().values().forEach(item -> item.setOnItemEvent(itemListener)));
} else if (c.wasRemoved()) {
c.getRemoved().forEach(removedObject -> removedObject.getProperties().values().forEach(item -> item.removeItemEventListener(itemListener)));
}
}
prepareData();
redraw();
};
categories = new ArrayList<>();
categoryObjectMap = new HashMap<>();
categoryObjectItemMap = new HashMap<>();
wasDragged = false;
mouseHandler = e -> handleMouseEvent(e);
listeners = new CopyOnWriteArrayList<>();
initGraphics();
registerListeners();
}
@Override public void init() {
LegendItem item1 = new LegendItem(Symbol.CIRCLE, "Item 1", Color.RED, Color.BLACK);
LegendItem item2 = new LegendItem(Symbol.SQUARE, "Item 2", Color.GREEN, Color.BLACK);
LegendItem item3 = new LegendItem(Symbol.TRIANGLE, "Item 3", Color.BLUE, Color.BLACK);
legend = new Legend(item1, item2, item3);
legend.setOrientation(Orientation.VERTICAL);
}
public void setMaskAnchorsStroke(Color anchorColor, double anchorWidth) {
if (isSettingValues || maskPane == null) {
return;
}
if (anchorColor == null) {
anchorColor = Color.BLUE;
}
if (anchorWidth <= 0) {
anchorWidth = 10;
}
if (topLeftHandler != null) {
topLeftHandler.setStroke(anchorColor);
topCenterHandler.setStroke(anchorColor);
topRightHandler.setStroke(anchorColor);
bottomLeftHandler.setStroke(anchorColor);
bottomCenterHandler.setStroke(anchorColor);
bottomRightHandler.setStroke(anchorColor);
leftCenterHandler.setStroke(anchorColor);
rightCenterHandler.setStroke(anchorColor);
topLeftHandler.setWidth(anchorWidth);
topLeftHandler.setHeight(anchorWidth);
topCenterHandler.setWidth(anchorWidth);
topCenterHandler.setHeight(anchorWidth);
topRightHandler.setWidth(anchorWidth);
topRightHandler.setHeight(anchorWidth);
bottomLeftHandler.setWidth(anchorWidth);
bottomLeftHandler.setHeight(anchorWidth);
bottomCenterHandler.setWidth(anchorWidth);
bottomCenterHandler.setHeight(anchorWidth);
bottomRightHandler.setWidth(anchorWidth);
bottomRightHandler.setHeight(anchorWidth);
leftCenterHandler.setWidth(anchorWidth);
leftCenterHandler.setHeight(anchorWidth);
rightCenterHandler.setWidth(anchorWidth);
rightCenterHandler.setHeight(anchorWidth);
if (AppVariables.getUserConfigBoolean("AnchorSolid", true)) {
topLeftHandler.setFill(anchorColor);
topCenterHandler.setFill(anchorColor);
topRightHandler.setFill(anchorColor);
bottomLeftHandler.setFill(anchorColor);
bottomCenterHandler.setFill(anchorColor);
bottomRightHandler.setFill(anchorColor);
leftCenterHandler.setFill(anchorColor);
rightCenterHandler.setFill(anchorColor);
} else {
topLeftHandler.setFill(null);
topCenterHandler.setFill(null);
topRightHandler.setFill(null);
bottomLeftHandler.setFill(null);
bottomCenterHandler.setFill(null);
bottomRightHandler.setFill(null);
leftCenterHandler.setFill(null);
rightCenterHandler.setFill(null);
}
}
if (polygonP1 != null) {
polygonP1.setStroke(anchorColor);
polygonP2.setStroke(anchorColor);
polygonP1.setWidth(anchorWidth);
polygonP2.setWidth(anchorWidth);
if (AppVariables.getUserConfigBoolean("AnchorSolid", true)) {
polygonP1.setFill(anchorColor);
polygonP2.setFill(anchorColor);
} else {
polygonP1.setFill(null);
polygonP2.setFill(null);
}
}
}
@FXML
public void defaultValuesColors() {
Color color = Color.BLUE;
confirmedRect.setFill(color);
FxmlControl.setTooltip(confirmedRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.RED;
healedRect.setFill(color);
FxmlControl.setTooltip(healedRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.BLACK;
deadRect.setFill(color);
FxmlControl.setTooltip(deadRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.SLATEBLUE;
IncreasedConfirmedRect.setFill(color);
FxmlControl.setTooltip(IncreasedConfirmedRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.HOTPINK;
IncreasedHealedRect.setFill(color);
FxmlControl.setTooltip(IncreasedHealedRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.GRAY;
IncreasedDeadRect.setFill(color);
FxmlControl.setTooltip(IncreasedDeadRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.PALEGREEN;
HealedConfirmedPermillageRect.setFill(color);
FxmlControl.setTooltip(HealedConfirmedPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.STEELBLUE;
DeadConfirmedPermillageRect.setFill(color);
FxmlControl.setTooltip(DeadConfirmedPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.MEDIUMPURPLE;
ConfirmedPopulationPermillageRect.setFill(color);
FxmlControl.setTooltip(ConfirmedPopulationPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.SADDLEBROWN;
DeadPopulationPermillageRect.setFill(color);
FxmlControl.setTooltip(DeadPopulationPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.LIGHTPINK;
HealedPopulationPermillageRect.setFill(color);
FxmlControl.setTooltip(HealedPopulationPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.BLUEVIOLET;
ConfirmedAreaPermillageRect.setFill(color);
FxmlControl.setTooltip(ConfirmedAreaPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.MEDIUMVIOLETRED;
HealedAreaPermillageRect.setFill(color);
FxmlControl.setTooltip(HealedAreaPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
color = Color.SILVER;
DeadAreaPermillageRect.setFill(color);
FxmlControl.setTooltip(DeadAreaPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));
}
Thermo()
{
this(Color.BLUE); //blue
}
Thermo()
{
this(Color.BLUE); //blue
}
public PixelMatrix() {
this(250, 250, 32, 32, Color.BLUE, Color.TRANSPARENT, PixelShape.SQUARE);
}
public Location() {
this(0, 0, 0, Instant.now(), "", "", Color.BLUE);
}
public Location(final double LATITUDE, final double LONGITUDE) {
this(LATITUDE, LONGITUDE, 0, Instant.now(), "", "", Color.BLUE);
}
private Color getColor(double dx, double dy) {
double distance = Math.sqrt((dx * dx) + (dy * dy));
double rverysmall = 0.65 * ((double) pickerSize / 2);
Color pixelColor = Color.BLUE;
if (distance <= rverysmall * 1.1) {
double angle = -Math.PI / 2.;
double angle1 = angle + 2 * Math.PI / 3.;
double angle2 = angle1 + 2 * Math.PI / 3.;
double x1 = rverysmall * Math.sin(angle1);
double y1 = rverysmall * Math.cos(angle1);
double x2 = rverysmall * Math.sin(angle2);
double y2 = rverysmall * Math.cos(angle2);
dx += 0.01;
double[] circle = circleFrom3Points(new Point2D(x1, y1), new Point2D(x2, y2), new Point2D(dx, dy));
double xArc = circle[0];
double yArc = 0;
double arcR = circle[2];
double Arco = Math.atan2(dx - xArc, dy - yArc);
double Arco1 = Math.atan2(x1 - xArc, y1 - yArc);
double Arco2 = Math.atan2(x2 - xArc, y2 - yArc);
double finalX = xArc > 0 ? xArc - arcR : xArc + arcR;
double saturation = map(finalX, -rverysmall, rverysmall, 255, 0);
double lightness = 255;
double diffAngle = Arco2 - Arco1;
double diffArco = Arco - Arco1;
if (dx < x1) {
diffAngle = diffAngle < 0 ? 2 * Math.PI + diffAngle : diffAngle;
diffAngle = Math.abs(2 * Math.PI - diffAngle);
diffArco = diffArco < 0 ? 2 * Math.PI + diffArco : diffArco;
diffArco = Math.abs(2 * Math.PI - diffArco);
}
lightness = map(diffArco, 0, diffAngle, 0, 255);
if (distance > rverysmall) {
saturation = 255 - saturation;
if (lightness < 0 && dy < 0) {
lightness = 255;
}
}
lightness = clamp(lightness, 0, 255);
if ((saturation < 10 && dx < x1) || (saturation > 240 && dx > x1)) {
saturation = 255 - saturation;
}
saturation = clamp(saturation, 0, 255);
pixelColor = HSL2RGB(currentHue, saturation, lightness);
}
return pixelColor;
}
public Location(final double LATITUDE, final double LONGITUDE, final String NAME, final String INFO) {
this(LATITUDE, LONGITUDE, 0, Instant.now() ,NAME, INFO, Color.BLUE);
}
public Location(final double LATITUDE, final double LONGITUDE, final double ALTITUDE, final String NAME) {
this(LATITUDE, LONGITUDE, ALTITUDE, Instant.now(), NAME, "", Color.BLUE);
}
public Location(final double LATITUDE, final double LONGITUDE, final double ALTITUDE, final Instant TIMESTAMP, final String NAME) {
this(LATITUDE, LONGITUDE, ALTITUDE, TIMESTAMP, NAME, "", Color.BLUE);
}
@Override public void init() {
List<XYChartItem> xyItem1 = new ArrayList<>(NO_OF_X_VALUES);
List<XYChartItem> xyItem2 = new ArrayList<>(NO_OF_X_VALUES);
List<XYChartItem> xyItem3 = new ArrayList<>(NO_OF_X_VALUES);
List<XYChartItem> xyItem4 = new ArrayList<>(NO_OF_X_VALUES);
for (int i = 0 ; i < NO_OF_X_VALUES ; i++) {
xyItem1.add(new XYChartItem(i, RND.nextDouble() * 12 + RND.nextDouble() * 6, "P" + i, COLORS[RND.nextInt(3)]));
xyItem2.add(new XYChartItem(i, RND.nextDouble() * 7 + RND.nextDouble() * 3, "P" + i, COLORS[RND.nextInt(3)]));
xyItem3.add(new XYChartItem(i, RND.nextDouble() * 3 + RND.nextDouble() * 4, "P" + i, COLORS[RND.nextInt(3)]));
xyItem4.add(new XYChartItem(i, RND.nextDouble() * 4, "P" + i, COLORS[RND.nextInt(3)]));
}
xySeries1 = new XYSeries(xyItem1, ChartType.LINE, Color.rgb(255, 0, 0, 0.5), Color.RED);
xySeries2 = new XYSeries(xyItem2, ChartType.LINE, Color.rgb(0, 255, 0, 0.5), Color.LIME);
xySeries3 = new XYSeries(xyItem3, ChartType.LINE, Color.rgb(0, 0, 255, 0.5), Color.BLUE);
xySeries4 = new XYSeries(xyItem4, ChartType.LINE, Color.rgb(255, 0, 255, 0.5), Color.MAGENTA);
xySeries1.setSymbolsVisible(false);
xySeries2.setSymbolsVisible(false);
xySeries3.setSymbolsVisible(false);
xySeries4.setSymbolsVisible(false);
// XYChart
Converter tempConverter = new Converter(TEMPERATURE, CELSIUS); // Type Temperature with BaseUnit Celsius
double tempFahrenheitMin = tempConverter.convert(0, FAHRENHEIT);
double tempFahrenheitMax = tempConverter.convert(20, FAHRENHEIT);
lineChartXAxisBottom = createBottomXAxis(0, NO_OF_X_VALUES, true);
lineChartYAxisLeft = createLeftYAxis(0, 20, true);
lineChartYAxisRight = createRightYAxis(tempFahrenheitMin, tempFahrenheitMax, false);
xyChart = new XYChart<>(new XYPane(xySeries1, xySeries2, xySeries3, xySeries4),
lineChartYAxisLeft, lineChartYAxisRight, lineChartXAxisBottom);
// YChart
List<YChartItem> yItem1 = new ArrayList<>(20);
List<YChartItem> yItem2 = new ArrayList<>(20);
List<YChartItem> yItem3 = new ArrayList<>(20);
for (int i = 0 ; i < 20 ; i++) {
yItem1.add(new YChartItem(RND.nextDouble() * 100, "P" + i, COLORS[RND.nextInt(3)]));
yItem2.add(new YChartItem(RND.nextDouble() * 100, "P" + i, COLORS[RND.nextInt(3)]));
yItem3.add(new YChartItem(RND.nextDouble() * 100, "P" + i, COLORS[RND.nextInt(3)]));
}
ySeries1 = new YSeries(yItem1, ChartType.RADAR_SECTOR, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(255, 0, 0, 0.5)), new Stop(0.5, Color.rgb(255, 255, 0, 0.5)), new Stop(1.0, Color.rgb(0, 200, 0, 0.8))), Color.TRANSPARENT);
ySeries2 = new YSeries(yItem2, ChartType.SMOOTH_RADAR_POLYGON, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(0, 255, 255, 0.5)), new Stop(1.0, Color.rgb(0, 0, 255, 0.5))), Color.TRANSPARENT);
ySeries3 = new YSeries(yItem3, ChartType.SMOOTH_RADAR_POLYGON, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(255, 255, 0, 0.5)), new Stop(1.0, Color.rgb(255, 0, 255, 0.5))), Color.TRANSPARENT);
yChart = new YChart(new YPane(ySeries1, ySeries2, ySeries3));
lastTimerCall = System.nanoTime();
timer = new AnimationTimer() {
@Override public void handle(final long now) {
if (now > lastTimerCall + UPDATE_INTERVAL) {
ObservableList<XYChartItem> xyItems = xySeries1.getItems();
xyItems.forEach(item -> item.setY(RND.nextDouble() * 8 + RND.nextDouble() * 10));
xyItems = xySeries2.getItems();
xyItems.forEach(item -> item.setY(RND.nextDouble() * 4 + RND.nextDouble() * 10));
xyItems = xySeries3.getItems();
xyItems.forEach(item -> item.setY(RND.nextDouble() * 3 + RND.nextDouble() * 4));
xyItems = xySeries4.getItems();
xyItems.forEach(item -> item.setY(RND.nextDouble() * 4));
ObservableList<YChartItem> yItems = ySeries1.getItems();
yItems.forEach(item -> item.setY(RND.nextDouble() * 100));
yItems = ySeries2.getItems();
yItems.forEach(item -> item.setY(RND.nextDouble() * 100));
yItems = ySeries3.getItems();
yItems.forEach(item -> item.setY(RND.nextDouble() * 100));
// Can be used to update charts but if more than one series is in one xyPane
// it's easier to use the refresh() method of XYChart
//xySeries1.refresh();
//xySeries2.refresh();
//xySeries3.refresh();
//xySeries4.refresh();
// Useful to refresh the chart if it contains more than one series to avoid
// multiple redraws
xyChart.refresh();
//ySeries1.refresh();
//ySeries2.refresh();
yChart.refresh();
lastTimerCall = now;
}
}
};
}
private Parent createContent() {
Cube c = new Cube(1, Color.GREEN);
c.setTranslateX(-1);
c.setRotationAxis(Rotate.Y_AXIS);
c.setRotate(45);
Cube c2 = new Cube(1, Color.BLUE);
c2.setTranslateX(1);
c2.setRotationAxis(Rotate.Y_AXIS);
c2.setRotate(45);
Cube c3 = new Cube(1, Color.RED);
c3.setRotationAxis(Rotate.Y_AXIS);
c3.setRotate(45);
camera = new PerspectiveCamera(true);
translate = new Translate(0, 0, -10);
rotate = new Rotate(0, new Point3D(0, 1, 0));
camera.getTransforms().addAll(translate, rotate);
PointLight light = new PointLight(Color.WHITE);
light.setTranslateX(3);
light.setTranslateZ(-5);
TranslateTransition tt = new TranslateTransition(Duration.seconds(2), light);
tt.setFromX(-3);
tt.setToX(3);
tt.setAutoReverse(true);
tt.setCycleCount(Animation.INDEFINITE);
AmbientLight globalLight = new AmbientLight(Color.WHITE.deriveColor(0, 1, 0.2, 1));
worldRoot.getChildren().addAll(c, c2, c3, globalLight, light);
SubScene subScene = new SubScene(worldRoot, 800, 600, true, SceneAntialiasing.BALANCED);
subScene.setCamera(camera);
tt.play();
return new Group(new Rectangle(800, 600), subScene);
}
/**
* @param numericAttributes
* @param stringAttributes
*/
public GraphNode(Map<String, Double> numericAttributes, Map<String, String> stringAttributes) {
this(Point2D.ZERO, "", Color.BLUE, numericAttributes, stringAttributes);
}