Hello. I've made the reservation system as follows: I have a class that asks for the number of seats to reserve. After returning from this class, a thread is created. This thread makes the reservation. After the thread.start() I have a call to a method that refreshes the data to be show in the JTable. My problem is, when I book a seat, the refresh data method is executed before the thread The code is as follows:
I've tried with the .isAlive() method from the thread, but this just hangs the program, as the thread is allways alive, even after it has finished the execution! What is the best way to solve this? Thanks, Miguel
My problem is, when I book a seat, the refresh data method is executed before the thread.
Move your "refresh" method to the end of the run() method of the "reserve" thread. Eugene.
Joined: Oct 24, 2002
Hello. Problem solved. Instead of reservation class implementing the runnable interface, it is now a normal class. I've changed the reservation method in the main window so that it creates the thread and implements the runnable as a abstract class and it's here that i call the reserve folowed by the refresh.
Now it works . I've also made the same for the read of the database (refreshTableData() method). Thanks, Miguel
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com