-1

I'm simply trying to bring to front a JFrame with a progress bar. I've been trying everything:

this.progressFrame.setVisible(true);
this.progressFrame.toFront();
this.progressFrame.repaint();

but the frame remains not visible, iconized, and the icon keeps flashing.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
D.L.
  • 201
  • 6
  • 14
  • Post [MCVE](http://stackoverflow.com/help/mcve) for help. – alex2410 Sep 15 '14 at 10:51
  • 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minial Complete Verifiable Example). 2) See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) 3) It is likely the 'frame' with a progress bar should be a modal dialog (with a progress bar), and that the EDT is being blocked. But an MCVE will reveal all.. – Andrew Thompson Sep 15 '14 at 10:51
  • @jbutler483 Solved using JDialog instead of JFrame, and using: this.progressDialog.setVisible(true); this.progressDialog.setAlwaysOnTop(true); this.progressDialog.toFront(); As indicated in your link. You can add your own answer, if you want. – D.L. Sep 15 '14 at 11:05
  • added an answer for future reference – jbutler483 Sep 15 '14 at 11:32

2 Answers2

3

For possible future reference.

You'd be better to use JDialog instead of JFrame,

that way you can use:

this.progressDialog.setVisible(true);
this.progressDialog.setAlwaysOnTop(true);
this.progressDialog.toFront(); 

As described through this link.

Community
  • 1
  • 1
jbutler483
  • 24,074
  • 9
  • 92
  • 145
2

Go down the following steps:
1. Make sure the frame appears on the correct monitor (in case you have multiple monitors, check them out too).
2. Make sure the frame size is good enough to see it.
3. Try adding frame.setBackground(Color.RED), this should make your window a vibrant red.
4. If you're using Windows 7 or 8, use Alt+TAB to have Windows highlight the window for you.
5. If none of these things have helped you, your bug is probably elsewhere... Try isolating bits of your code.

For better help, post information and/or show some more code of your program.

Roland
  • 612
  • 5
  • 17