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

JDialog and JFrame show dirty black lines

XMLWordPrintable

    • windows_8

      FULL PRODUCT VERSION :
      java 1.6.0_39 and java 1.7.0_13

      ADDITIONAL OS VERSION INFORMATION :
      windows 8 6.2

      A DESCRIPTION OF THE PROBLEM :
      JDialog and JFrame show dirty black lines that disappear if they are resized.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Start the added application. There is a JDialog on a JFrame. The JDialog and the JFrame have a dirty black line directly at the bottom of their header. This can be seen best, if they are deselected and do not have the focus.

      Resize the JDialog with the mouse by dragging the lower right corner until the smallest possible width and smallest possible height is reached and then enlarge the JDialog again. The dirty black line has disappeared.

      Do the same with the JFrame, to clear the dirty black line.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Proper painting of JDialog and JFrame, no dirty black lines.
      ACTUAL -
      Not proper painting of JDialog and JFrame, with dirty black lines.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package com.classwizard.cw;


      import java.awt.Container;
      import java.awt.Dimension;
      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;

      import javax.swing.JDesktopPane;
      import javax.swing.JDialog;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.WindowConstants;


      public class ClassWizard extends Object
      {
          public static void main(String args[]) throws Exception
          {
              try
              {
                  DialogTest ket = new DialogTest();
                  GJApp.launch(ket, " ButtonTest " ,0,0,700,700,null);
              }
              catch (Exception e)
              {
                  System.out.println(e.getMessage());
                  e.printStackTrace();
              }
          }
      }
      class GJApp extends WindowAdapter
      {
          public static void launch(final DialogTest f, String title,final int x, final int y,final int w, int h,String propertiesFilename)
          {
              f.setTitle(title);
              f.setBounds(x,y,w,h);
              f.setVisible(true);
              f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              f.addWindowListener(new WindowAdapter()
              {
                  public void windowClosed(WindowEvent e)
                  {
                      System.exit(0);
                  }
              });
          }
      }

      class DialogTest extends JFrame
      {
          protected JDesktopPane desktopPane = new JDesktopPane();
          TestDialog _tabdlg = null;
          
          public DialogTest() throws Exception
          {
              String osname = System.getProperty( " os.name " );
              String osversion = System.getProperty( " os.version " );
              String java_version = System.getProperty( " java.version " );
              System.out.println(osname + " " + osversion + " java: " + java_version + "
       " );
              
              // make a dialog with a drag button
              _tabdlg = new TestDialog(this, " dialog " , false);
              _tabdlg.init();
              _tabdlg.setVisible(true);
              _tabdlg.setLocation(300, 100);

          }
      }

      class TestDialog extends JDialog
      {
          TestDialog _dlg = null;
          DialogTest _owner = null;
          
          public TestDialog(DialogTest owner, String title, boolean modal)
          {
              super(owner,title,modal);
              _owner = owner;
              _dlg = this;
          }

          public void init()
          {
              JPanel paraPanelTop = new JPanel();
              paraPanelTop.setPreferredSize(new Dimension(150, 50));

              Container diacontent = this.getContentPane();
              diacontent.add(paraPanelTop);
              setPreferredSize(new Dimension(160, 300));
              setResizable(true);
              pack();
          }
      }
          

      ---------- END SOURCE ----------

            aivanov Alexey Ivanov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: