【发布时间】:2020-05-07 22:43:31
【问题描述】:
我想建造巴黎地铁,所以我需要用正确的颜色将所有车站显示为一个圆圈。这是我得到的:All the stations displayed。但是,我希望所有符号都是圆圈,但我找不到怎么做。以下是我的代码:
public static void setChartsAndLegend(Color color, ScatterChart<Number, Number> sc, int size) {
String colorHex = "#"+Integer.toHexString(color.getRGB()).substring(2);
String blackHex = "#"+Integer.toHexString(Color.BLACK.getRGB()).substring(2);
int metroSize = 3*size;
int hubSize = 4*size;
String metroSizeString = String.valueOf(metroSize);
String hubSizeToString = String.valueOf(hubSize);
Set<Node> nodes = sc.lookupAll(".series" + 0);
for (Node n : nodes) {
n.setStyle("-fx-background-color: " + colorHex + ";\n"
+ " -fx-background-insets: 0, 2;\n"
+ " -fx-background-radius: " + metroSizeString + "px;\n"
+ " -fx-padding: " + metroSizeString + "px;");
}
nodes = sc.lookupAll(".series" + 1);
for (Node n : nodes) {
n.setStyle("-fx-background-color: " + blackHex + ", white;\n"
+ " -fx-background-insets: 0, 2;\n"
+ " -fx-background-radius: " + hubSizeToString + "px;\n"
+ " -fx-padding: " + hubSizeToString + "px;");
}
}
这是我用来显示一行的功能,但是当我想显示多行时,符号不再是圆圈了。有人有想法吗?谢谢你。
【问题讨论】:
标签: java javafx geometry symbols scatter