Hey all, for quite some time I've been working on an inventory management program for work, and I'm having a bit of an issue with the rendering of a JFrame notification window, I'll do my best to explain below (including screenshots).
So my program works with a remote FTP server to store information, and because of the immense amount of data being transferred over the network, there is a few second delay (program locks up basically) when performing operations that involved data transfer. What I have decided to do, is have a pretty looking JFrame pop up informing the user of network usage when these actions start up, and then hide when the code is done (it should look like this screenshot). The problem is the window fails to render when it is made visible during these events - when the file transfers occur right after the .setVisible(true); call. (Which looks like this screenshot) If the JFrame's .setVisible(true); call is made with the "server" object file transfer call's commented, everything works fine (as seen in the first listed screenshot).
This leads me to believe that the Thread is getting locked up from the file transfer before it's done rendering the swing elements (I've done this with a basic window as well - not all jazzed up like you've seen in the screenshots so I know it has nothing to do with the visual styling itself). I've tried making Thread.yield(); calls and Thread.sleep(1000); to give it time to render but that doesn't seem to help (probably because the JFrame call is on the same Thread). Any thoughts on what I should do to give it just a tiny bit more time to render or any other ideas - possibly put the file transfers on a different Thread - haven't tried this before, how would I do it?
Any help is appreciated!