I am developing a swing application concerning university management system and schedule generation (using java swing) as the figure below:
The user have to reserve a room for a given course
(this is done by selecting a course in the JTable and by clicking the Reserve button
The process of rooms reservation is done using a JOptionPane which loads all the rooms and put them as a matrix of JButton on the JFrame and this JFrame is cloned on the JOptionPane window like this figure below :
According to the high number of rooms and the number of time slot in each day, this reservation window take about 10 - 15 seconds to load all theses rooms,
Then after reserving a room, the window closes or the user can close the window without reserving by clicking the "OK" button
But when i reopen this same window, it takes about 3-4 seconds only !
And this is when i close the connection to database after getting the data (the rooms names) , and after closing the window ! (JOptionPane)
My question is : what is the reason ?
If I close the cnx and the window, why the second time i open this window ( as long as the application runs in the same session), it takes less time?
It seems that this window still in the memory of the pc or something else?
Any suggestions?