It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center




8年前关闭。




如何使 Swing Jbutton 变灰/变灰?我可以使用什么方法?另外,我怎样才能让它在 Netbeans 中默认变灰?

最佳答案

button.setEnabled(false);

上面的按钮应该变灰就好了。我会确保您将文档添加为书签或下载并仔细阅读

编辑

我的假设是您正在使用 Netbeans 中的 GUI 创建者。我强烈建议阅读 Swing 并学习语言而不是 IDE(有时您必须使用与 Netbeans 不同的 IDE,并且不知道如何制作 GUI)

关于java - 如何在 Java 中使 JButton 变灰,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13183920/

10-09 19:28