如何从正在运行的小程序获取信息?
我正在 appletviewer 中运行一个小 applet 游戏,并且我有另一个 java 程序,它定期尝试从 applet 获取“分数”字段。
然而现在我尝试这样做的方式是(稍微伪代码化):
小程序 myGame = Game();
Runtime.exec("appletviewer 游戏");
得分 = myGame.getCurrentScore;
问题是我初始化的小程序变量与小程序查看器创建的小程序不对应。我该如何解决这个问题?
I'm running a little applet game in the appletviewer, and I have another java program that periodically tries to get the 'score' field from the applet.
However right now the way I'm trying to do this is (slightly pseudocode-ified):
Applet myGame = Game();
Runtime.exec("appletviewer Game");
score = myGame.getCurrentScore;
The problem is that the applet variable that I initialize doesn't correspond to the Applet created by the appletviewer. How can I resolve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你将无法做到这一点。几个选项:
myGame.startGame()
。)You wouldn't be able to do that. A few options:
myGame.startGame()
.)