JDialog transparent

I have a JDialog that closes when a variable in another class changes. It works fine but the problem is that the dialog is transparent! The outside parts of the window are visible but the interior is see through. Here is how I set up the JDialog:

boolean visible;

JButton stop;

final JDialog playingDialog =new JDialog(frame,"Playing...",false);

ImageIcon dialogIcon =new ImageIcon(stupidWindowsPath +"images\\dialog.png");

playingDialog.getContentPane().setLayout(new playLayout());

JLabel dialogLabel=new JLabel(dialogIcon);

JLabel playing=new JLabel("Playing...");

status.setMessage("Playing..");

dialogLabel.setIcon(dialogIcon);

playingDialog.getContentPane().add(dialogLabel);

playingDialog.getContentPane().add(playing);

stop =new JButton("Stop");

playingDialog.getContentPane().add(stop);

stop.addActionListener(new ActionListener(){

publicvoid actionPerformed(ActionEvent e){

orhb.stopPlay();

playingDialog.setVisible(false);

}

});

playingDialog.setSize(272, 119);

playingDialog.setLocation(186,294);

playingDialog.setResizable(false);

playingDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

visible=true;

playingDialog.setVisible(visible);

while(visible)

if(CONDITION FROM OTHER CLASS)

visible=true;//i've tried putting playingDialog.repaint() in here

else

visible=false;

playingDialog.setVisible(visible);

When I take out the while loop the dialog shows up but does not close when the condition is met (obviously). Does anyone have any suggestions for me?

[2634 byte] By [walden_rainesa] at [2007-11-27 1:25:39]
# 1

The while loop is blocking the event dispatch thread, so the dialog will not show.

Read here about Threads and Swing:

http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html

Anyway this is a very strange way to hide a dialog.

Instead of changing the condition in another class and checking it here, just call playingDialog.setVisible(false) from the other class when you want to hide the dialog...

Rodney_McKaya at 2007-7-12 0:18:48 > top of Java-index,Desktop,Core GUI APIs...