I have class that updates a component that is synchronized to a song. When I first run it, it takes a while to load the song, then displays the graphics piece by piece as they load.
I was wondering if/how to have the JFrame display a loading screen while it is loading both my Clip and my component's graphics.
Also, "stageComponent.setDoubleBuffered(true)" doesnt seem to do anything.
public static void main(String[] args)
{
loadSong(SONG_NAME);
JFrame frame = new JFrame(TITLE);
stageComponent = new StageComponent();
stageComponent.setDoubleBuffered(true);
frame.add(stageComponent);
frame.setVisible(true);
// If my stuff is loaded then start it all?
if (stageComponent.isShowing() && clip.isOpen()) {
Timer t = new Timer(TIME_DELAY, null);
final long initialTime = System.currentTimeMillis();
ActionListener stageListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {
stageComponent.playSequences((int)(System.currentTimeMillis() - initialTime));
}
};
t.addActionListener(stageListener);
// This will play song and start timer at basically the same time right?
clip.start();
t.start();
}
}
Thanks in advance!