setEnabled

Check whether a JLabel is Enabled or Visible.

JLabel.setEnanbled() methods enable a JLabel or make it visible in it container.If you set false, the JLabel is not visible and if set truth, the JLabel is visible. Below code creates two JLabels, one is enabled and the other is not enabled.

JTextField-setEnabled-method

JTextField setEnabled Method

Below code shows how to enable or disable JTextField added in a JFrame window.JTextField inherits its methods from the class swing.Note the differences between the two fields

See also: How to create Read Only JTextField

Enabling and Disabling JButton using setEnabled Method

Enabling and Disabling JButton can be easily done using setEnabled Method.JButton class is used to add platform independent buttons to swing programs. Other JButton Methods are:- JButton setToolTipText JButton setText JButton getText Using JButton setEnabled Method  

This program is simple.When the user clicks…