Java小程序drawString不工作
请帮忙,我正在构建一个 Java 小程序,它不允许我显示变量。看,这段代码有效:
g.drawString("wassup",50,25);
但是这段代码无效:
int timerx = 10000;
g.drawString(timerx,50,25);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有两个
Graphics.drawString()
方法。一个接受String
作为第一个参数,另一个接受AttributedCharacterIterator
。您尝试传递int
作为第一个参数,但没有与该签名匹配的方法。如果您想打印字符
“10000”
,请尝试以下代码。There are two
Graphics.drawString()
methods. One accepts aString
as a first argument and the other accepts anAttributedCharacterIterator
. You are attempting to pass anint
as the first argument, but there is no method that matches that signature.If you want to print the characters
"10000"
, try the following code.