I am developing a java application which will be graphically depicting and organizing hundreds of objects. Each of these objects is loaded in from a SQL database, for use in this program.
I plan to keep a local copy of all the data, retrived through a JDBC connection, and then sort it locally (Likely with Merge Sort as that is my favorite)
How would you recommend I store the data locally? Ideally, it would be very easy to traverse, sort and compare to the source Database.
Currently, I have objects called Ideas which are populated from the database. Then, to display them, I create the same number of IdeaGraphics objects and add them to the appropriate JPanels. This can be quite slow at times.
You can implement the Comparator interface and use Collections.sort(), a modified mergesort, as shown here.
Maybe you already did that but it's not so clear in your question:
You can get almost as many instances of your data class (Ideas) but it's not the same at all with graphic classes. Limit the number of widgets and graphics to 1.
Build your own custom JPanel class, give it a list of Ideas and override the paintComponent method to draw all items in the list.
If your visible area is large, double buffer it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With