java - JPanel not showing after panel.setVisible(true) -


i'm working on desktop app, goal fetch given url jsoup.connect(). works fine, takes couple of secs, tought i'll display "loading" gif or while it's not complete. fetch , display loading jpanel same button click.

if want set jpanel visible button click, works fine (code below)

private void btnrefreshselectedactionperformed(actionevent e) {     panelrefresh.setvisible(true); } 

but when add url fetching, panel won't show up, should see 1-3 secs. code:

private void btnrefreshselectedactionperformed(actionevent e) {     panelrefresh.setvisible(true);     //swingutilities.invokelater(() -> panelrefresh.setvisible(true)); - still not working      //do jsoup.connect , other things (1-3 secs runtime)     //...      panelrefresh.setvisible(false); } 

what problem?

i'm not familiar jsoup api, guessing, but.. sure method jsoup.connect() synchronous? perhaps initiates connection on separate thread , returns immediately, other thread calls handler when connection got established?

in case jpanel visibility switched false after true, in practice don't see @ all. if that's case should change visibility on handler called when connection gets established rather in btnrefreshselectedactionperformed method.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -