StackOverFlow Problem in main() function...

Hi. I tried starting a small frame with a progress indicator while the user waits for the main application to run.

this is the code of my ProgressBar Class

publicclass ProgBarextends JFrame{

JProgressBar bar =new JProgressBar();

public ProgBar()

{

super();

getContentPane().setLayout(new BorderLayout());

getContentPane().add(bar, BorderLayout.CENTER);

bar.setIndeterminate(true);

pack();

}

publicvoid hide()

{

setVisible(false);

dispose();

}

}

and this the code of my main() function

publicstaticvoid main(String[] args)

{

final ProgBar bar =new ProgBar();

bar.setVisible(true);

SwingUtilities.invokeLater(new Runnable(){

publicvoid run(){

System.out.println("Starting application");

Options op =new Options();

OdessaClient oc =new OdessaClient(op);

oc.setVisible(true);

}

});

bar.hide();

}

but I keep getting StackOverflow Errors: Like this:

Exception in thread"main" java.lang.StackOverflowError

at java.awt.Component.show(Component.java:1302)

at java.awt.Component.setVisible(Component.java:1253)

What am I doing wrong?

[2386 byte] By [xpantaa] at [2007-11-27 2:43:08]
# 1

I don't know what's going wrong, but you should be able to pinpoint where the problem is quite easily by running through a debugger, and if you don't know how to use a debugger, just comment out lines of code, and slowly uncomment, until you get the error, and then you know that it went wrong on that line of code.

DragonSlayrea at 2007-7-12 3:08:25 > top of Java-index,Java Essentials,New To Java...