Using Swing 0.6 and JDK1.2, the background color of JDialog cannot be set.
The application given below creates a JDialog and invokes
setBackground(Color.green) on it.
On Solaris, when the JDialog is displayed, it flashes green for a brief
moment, then turns gray.
On NT, it comes up gray.
/*==================================================================*/
/*
* Swing 0.6 - Can't set the background color of JDialog
*/
import java.awt.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JDialogTest {
static JFrame frame = new JFrame();
static JDialog dialog = new JDialog(frame);
public static void main (String[] args) {
dialog.setSize(200,200);
dialog.setBackground(Color.green); // Green, buddy - not gray
dialog.setVisible(true);
dialog.addWindowListener (new WindowAdapter () {
public void windowClosing (WindowEvent e) {
dialog.dispose ();
System.exit (0);
}
});
}
}
/*==================================================================*/