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

Unexpected result for drawOval

XMLWordPrintable

    • 2d
    • x86
    • windows_8

      FULL PRODUCT VERSION :
      Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
      java version "1.8.0_72"
      Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
      Java HotSpot(TM) Client VM (build 25.72-b15, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      It looks there is problem with Graphics2D drawOval function gives unpredictable shapes if it is used to paint child component and the parent of this component is JScrollPane and the size on the child component has a huge height about 77660240 and this set by setPreferredSize(new Dimension(1960 , 77660240));

      REGRESSION. Last worked in version 8u72

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      After execute the program a window will appear with scroll bar.
      Scroll down until reach to the end in vertical direction.
      Expected to draw 5 circles but draws shape not like circle

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Draw circles
      ACTUAL -
      Draw shape not like circle

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class TestMain
      {
          public static void main(String[] args)
          {
              JFrame f = new JFrame();
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JScrollPane jsp = new JScrollPane();
              jsp.setViewportView(new TestPanel());
              f.getContentPane().add(jsp);
              f.setSize(500,400);
              f.setLocation(200,200);
              f.setVisible(true);
          }
      }
        
      class TestPanel extends JPanel
      {
          public TestPanel()
          {
              setPreferredSize(new Dimension(1960 , 77660240));
              setBackground(Color.white);
          }
        
          protected void paintComponent(Graphics g)
          {
              super.paintComponent(g);
              Graphics2D g2 = (Graphics2D)g;
              g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                  RenderingHints.VALUE_ANTIALIAS_ON);
              g2.drawRect(30, 77660141, 100, 20);
              g2.drawOval(15, 77660141, 10, 10);
              g2.draw(new Ellipse2D.Double(140, 77660141,
                                   10,
                                   10));
              g2.draw(new Ellipse2D.Double(160, 77660141,
                                   10,
                                   10));
              g2.draw(new Ellipse2D.Double(180, 77660141,
                                   10,
                                   10));
              g2.draw(new Ellipse2D.Double(200, 77660141,
                                   30,
                                   30));
          }
      }
      ---------- END SOURCE ----------

      SUPPORT :
      YES

            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: