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);
添加回答
舉報