By default, all components are enabled. However, we may wish to disable a component. A disabled component cannot respond when clicked by the user. Having disabled a component, as a result of user actions we may wish to enable it again. Enabling and disabling are performed by the javax.swing.JComponent.setEnabled(boolean) method. For example, the statement
button2.setEnabled(false);
will disable the JButton object button2. Some disabled components, such as buttons, will take on a different (usually fainter) appearance from their enabled counterparts.
Home
Developing GUIs
Enabling and Disabling Components
How to Enabling and Disabling Components in Java
How to Enabling and Disabling Components in Java
Tags
# Developing GUIs
# Enabling and Disabling Components
Share This
Enabling and Disabling Components
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment