How to get label.getWidth() in javafx

前端 未结 4 932
余生分开走
余生分开走 2021-01-03 04:11

always when i try to get the width of an Array in Java it just returns 0 and i dont know why. Can somebody explain to me how it is done right?

                       


        
4条回答
  •  爱一瞬间的悲伤
    2021-01-03 04:29

    I don't think the width will be calculated until the Label is shown: add it to a Parent that is visible and you should get a non-zero result.

提交回复
热议问题