I developed a Swing GUI that contains 12 JPanels. Initially, all the code JPanelwas written in the main code of the class JFrame. As a result, the code became too long (more than 10,000 lines).
Now I want to reorganize the code in order to break the code into 13 classes (12 classes for one JPaneland 1 class for the main one JFrame) instead of 1 class carrying all the code.
But I have some confusion, which are as follows:
- Initially, those 12
JPanelwere installed on the "Map" JPanel, and the layout of the "Card" JPanelwas set to CardLayout, so only 1 JPanelof the 12 is JPanelshown based on the button that the button is clicked on. Now that I have divided those 12 JPanelinto MainJFormand implemented each of them into my own class, it seems to me that I need to create an instance JPanelwhen the user clicks the button. So, it would be better to do this heavy task on EDT (Event Dispath Thread). If not, will this work to instantiate the JPanel stream SwingWorkerand pass the ref link. to EDT?
source
share