Hi Neil
Originally posted by Neil Campbell:
Hi,
I am working on the URLyBird assignment - but this is a more general question...
On my "Search Results" Page I have a JTable. I also have a JTextField, for the customer ID to be entered, and a JButton to "Book".
I'm looking to disable the JButton until:
- a row in the JTable has been selected
- and, an 8-Digit customer ID has been entered.
The JTable is setup so it cannot be edited, and only one row can be selected at a time.
I've had a play around with the API, but not getting anywhere.
Any hints would be much appreciated,
Neil
One way of doing is you disable the button when you show results using setEnable(false) at the beginning. Later when the events you want occur, then in those respective event handler methods(like item selection handler method for table), enable the button using setEnabled(true).
This is one approach. Good Luck.