开发者

Basic question about JLabel

Since i declare:

double total = 12.00;

why i cant put:

p1.add(jlbTotal= new JLabel (total));

Is there 开发者_如何学Pythonany way I can use to insert that total value?


JLabel does not take doubles in its constructors. You first need to convert your double to a String. For example:

new JLabel(String.valueOf(total));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜