Java ButtonModel.isEnabled()
Syntax
ButtonModel.isEnabled() has the following syntax.
boolean isEnabled()
Example
In the following code shows how to use ButtonModel.isEnabled() method.
import java.awt.BorderLayout;
// www . j a v a2 s. c o m
import javax.swing.JCheckBox;
import javax.swing.JFrame;
public class Main {
public static void main(String[] a) {
JFrame frame = new JFrame("Selecting CheckBox");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JCheckBox checkBox = new JCheckBox("Hi");
checkBox.getModel().setEnabled(false);
System.out.println(checkBox.getModel().isEnabled());
frame.add(checkBox, BorderLayout.NORTH);
frame.setSize(300, 100);
frame.setVisible(true);
}
}
Home »
Java Tutorial »
javax.swing »
Java Tutorial »
javax.swing »