Skip to content
Advertisement

Enable a JButton when some component changed its border color [closed]

My goal is to enable a JButton only when some JTextFields and JComboBox change its border color from red to green.
These components are included in three different JPanel.
I try to create a function that reads all components in a JPanel but, when I’m going to compared the colors, the program returns me that I’m casting the variables in a bad way.
Below there’s my function.
Can someone help me?

JavaScript

Advertisement

Answer

When you change the border of a component, a property listener will be fired. You can register a property listener to the combobox/textfield and enable/disable the button according to the new border.

An example:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement