如何使用循环制作大量具有不同名称的 JButtons / JLabels?
我将如何创建大量的 JButton 和 JLable 而不必声明一长串,我不知道如果我做了一个 for 循环,例如“for (int I = 0; I < 30; I++) { JButton 按钮 = new JButton(); 虽然这会创建许多按钮,但我希望稍后能够单独编辑每个按钮,那么我将如何执行这个按钮循环,但它们都有不同的名称。 非常感谢任何帮助:)
How would I go about creating lots of JButtons and JLables without having to declare a long list of them , I'm not sure how to do it if I made a for loop which said e.g. "for (int I = 0; I < 30; I++) { JButton button = new JButton(); }
Although this would create many buttons I want to be able to individually edit each button later on so how would I do this loop of buttons but them all having different names.
Any help is very much appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论