java中的变量压缩和扩展?
当我单击包含信息的标签时,我想创建一系列新窗口。我希望这些窗口成为孤立的。有没有办法将静态变量传递给类并告诉它继续监视该变量的状态?
基本上我想说
NewOrphanedWindow.main(StaticClass.ValueToMonitorFromNowOn);
有没有办法做到这一点,或者是否必须在另一侧进行编程?
我基本上想要一个窗口,它将接收变量字符串名称,然后使用该变量字符串来引用实际的静态变量。
I would like to create a series of new windows when I click labels containing information. I want these windows to be orphaned. Is there a way to pass a static variable to a class and tell it to keep monitoring the status of that variable?
Basically I want to say
NewOrphanedWindow.main(StaticClass.ValueToMonitorFromNowOn);
Is there a way to do this, or does it have to be programmed on the other side?
I basically want a window that will receive a variable String name and then use that variable String to reference the actual static variable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不确定您到底想做什么,但您可以通过在调用 main 之前设置静态变量来实现它:
Not sure what exactly you are trying to do, but you can achieve it by setting a static variable before calling main:
您可以在窗口类中运行一个线程,该线程每 X 秒检查一次变量的值并做出相应的响应:
You could run a thread in your window class which checks the value of the variable every X seconds and responds accordingly:
查找表是必经之路
Lookup table is the way to go