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

Plugin doesn't use Grahipcs2D consistently

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • deploy
    • x86
    • windows_nt



      Name: boT120536 Date: 02/08/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      If you write a simple bean using the Graphics2D graphics context in its paint()
      method, the bean doesn't paint at all when hosted in eg. Word 97 using the
      ActiveX bridge distributed with JDK 1.3.0.

      In non-ActiveX contexts - eg. in Java2 applications, in the BeanBox, etc. - the
      paint() method works fine.

      Here's the code:

      package dk.hiq.umlwise.application;

      import java.awt.*;

      public class UMLDiagramBean
         extends java.awt.Panel
      {
         public UMLDiagramBean()
         {
         };
         public Dimension getPreferredSize()
         {
            return new Dimension(400, 300);
         };
        public void paint(Graphics g)
        {
           Dimension dim = getSize();
           //if (g instanceof Graphics2D) {
              Graphics2D g2 =(Graphics2D)g;
              g2.setStroke(new BasicStroke(2));
           //};
           g.setColor(Color.yellow);
           g.fillOval(1, 1, dim.width-2, dim.height-2);
           g.setColor(Color.blue);
           g.drawOval(1, 1, dim.width-2, dim.height-2);
        };

      };

      This code is compiled, packaged in a JAR and registered using the Packager.

      Then Word97 (SR-2) is started, some text is inserted, "Insert -> Object" is
      chosen, and the UmlBean is selected, and OK pressed.

      Cool: the colored oval appears.

      Now, if you select the text entered to begin with, the bean disappears! You can
      bring it back by double-clicking it, but whenever you deselect it,
      it "disappears" again.
      (Review ID: 111611)
      ======================================================================

            jmelvin James Melvin (Inactive)
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: