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

Dialog doesn't inherits icon from its parent frame

XMLWordPrintable

    • x86
    • linux

      Name: rmT116609 Date: 08/27/2003


      FULL PRODUCT VERSION :
      java version "1.4.2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
      Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)


      FULL OS VERSION :
      Linux vova.labs.intellij.net 2.4.20-20.9 #1 Mon Aug 18 11:45:58 EDT 2003 i686 i686 i386 GNU/Linux


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      KDE 3.1.3-0.9x.4 RedHat

      A DESCRIPTION OF THE PROBLEM :
      java.awt.Dialog doesn't inherit icon from its parent frame (icon is set by java.awt.Frame.setIconImage() method). Therefore all such dialogs has default ugly X11 icon. Due to it's impossible to set icon directly to dialog (why? all my native Win32 and Gnome/KDE application has icons for dialogs), all dialogs that belog to the Java application looks like they do not belong to the application because they have different icon.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Be sure that you are running KDE
      2. Compile and run the attached sample application

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      1. Appeared frame has "red square" icon
      2. Child dialog has same "red square" icon
      ACTUAL -
      Child dialog has default X11 icon

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;
      import java.awt.image.BufferedImage;

      /**
       * @author Vladimir Kondratyev
       */
      public class Test {
        public static void main(String[] args) {
          JFrame frame = new JFrame("Test");
          Container contentPane = frame.getContentPane();
          contentPane.setLayout(new BorderLayout());
          frame.addWindowListener(
            new WindowAdapter() {
              public void windowClosing(WindowEvent e) {
                System.exit(0);
              }
            }
          );

          BufferedImage image = new BufferedImage(16,16,BufferedImage.TYPE_INT_BGR);
          Graphics graphics = image.getGraphics();
          graphics.setColor(Color.RED);
          graphics.fillRect(0, 0, 32, 32);
          graphics.dispose();

          frame.setIconImage(image);

          frame.setBounds(300,300,400,300);
          frame.show();

          Dialog dialog = new Dialog(frame);
          dialog.setBounds(400,400, 100, 100);
          dialog.show();
        }
      }

      ---------- END SOURCE ----------
      (Incident Review ID: 200000)
      ======================================================================

            vbaranovsunw Vyacheslav Baranov (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: