1 回答
TA贡献1856条经验 获得超17个赞
为了演示它,我使用这两个图像:
构造一个如下所示的按钮:
堆叠图像并用作按钮的图形节点:
private static final String[] images = {
"https://i.imgur.com/g52UeNO.png",
"https://i.imgur.com/kvHOLJ4.jpg",
};
ImageView imageView1 = new ImageView(images[0]);
ImageView imageView2 = new ImageView(images[1]);
StackPane sp = new StackPane(imageView1, imageView2);
Button button = new Button("", sp);
编辑:要堆叠字符,请使用:
Text t1 = new Text(Character.toString('O'));
t1.setFont(Font.font ("Verdana", 20));
t1.setFill(Color.RED);
Text t2 = new Text(Character.toString('x'));
t2.setFont(Font.font ("Verdana", 12));
t1.setFill(Color.BLUE);
StackPane sp = new StackPane(t1, t2);
Button button = new Button("", sp);
添加回答
举报