How to make a javafx button with circle shape of 3xp diameter?

后端 未结 2 2014
无人共我
无人共我 2020-12-06 01:37

I want to make a VERY small round button with no text on it. Here is how I tried.

Button bt = new Button();
bt.setShape(new Circle(1.5));
bt.setMaxSize(3,3)         


        
2条回答
  •  既然无缘
    2020-12-06 02:24

    You just need to set also the min size. This will do:

    double r=1.5;
    btn.setShape(new Circle(r));
    btn.setMinSize(2*r, 2*r);
    btn.setMaxSize(2*r, 2*r);
    

    And it will give you a round and very small button. Not sure if you want to make it smaller, but you can do that too. Just change the radius r to the required value.

提交回复
热议问题