Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4092995

Swing 0.6 - Can't set the background color of JDialog

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs
    • None


      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);
                  }
               });
         }
      }
      /*==================================================================*/

            svioletsunw Scott Violet (Inactive)
            gaurisha Gauri Sharma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: