Hello from Ireland,
In NetBeans I created a class that extends JFrame called “SearchCustomerPage”. The class has a JButton called “Search” that has an ActionListener associated with it (so when I click “Search” a method is called).
I have another JFrame page (“NewBookingPage”) that creates bookings. To create a booking the user enters various details including a customer number. To enter a customer number the user must first search for a customer, the "SearchCustomerPage" comes in to play.
To bring up the "SearchCustomerPage" the user clicks the "addCustomer" button in the "NewBookingPage". This creates an instance of "SearchCustomerPage". So in the "NewBookingPage" code I create a "SearchCustomerPage" object.
Now my question:
Is it possible to get a signal (in "NewBookingPage") when the "Search" button is clicked ? (I want to execute some code in the "NewBookingPage" class when user clicks the "Search" button in the "SearchCustomerPage" object).
So class-a (NewBookingPage) gets a signal when class-b (SearchCustomerPage) button has been clicked.
I nearly sure I need to add a listener but just can’t figure it out. Maybe something like following:
SearchCustomerPage scp = new SearchCustomerPage();
scp.addComponentListener(); //to listen to the search button
Any help would be much appreciated.