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

Images disappear in JEditorPane w/HTML

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.4.1_01
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description



      Name: jk109818 Date: 04/24/2003


      FULL PRODUCT VERSION :
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]
      SP3


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      I've tried turning off all hardware video aceleration as
      well as disabling direct draw on my VM.

      You'll obviously need to have a valid HTML page for this.
      I'm using pages that have JPEGS 300x300 or greater.

      A DESCRIPTION OF THE PROBLEM :
      This affects JEditorPane and also as a result Java Help 1.1.3.

      All I have to do is create a JEditorPane (or help file) and
      load it with HTML. If the page contains a couple of images,
      chances are at some point during vertical scrolling, the
      images will disappear or become chopped off.

      Clearly some type of paint issue. If the window is
      minimized and then brought back up, the image appears again.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create JEditorPane
      2. Add to a JScrollPane
      3. Set Document

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Images shouldn't disappear while scrolling.

      REPRODUCIBILITY :
      This bug can be reproduced often.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;
      import java.net.URL;
      import javax.swing.event.*;
      import javax.swing.text.html.*;

      public class HelpFrame extends JFrame implements HyperlinkListener {
      private BorderLayout borderLayout1 = new BorderLayout();
      private JPanel jPanel1 = new JPanel();
      private BorderLayout borderLayout2 = new BorderLayout();
      private JScrollPane jScrollPane1 = new JScrollPane();
      private JPanel jPanel2 = new JPanel();
      private JButton jbClose = new JButton();
      private JEditorPane jEditorPane1 = new JEditorPane();
      private JFrame parent;

      public HelpFrame(JFrame parent) {
      super("Help");
      try {
      this.parent = parent;
      jbInit();
      pack();
      }
      catch (Exception e) {
      e.printStackTrace();
      }

      }

      private void jbInit() throws Exception {

      this.getContentPane().setLayout(borderLayout1);
      jPanel1.setLayout(borderLayout2);
      jbClose.setText("Close");
      jbClose.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
      jbClose_actionPerformed(e);
      }
      });
      jEditorPane1.setEditable(false);
      jEditorPane1.setContentType("text/html");
      jScrollPane1.setPreferredSize(new Dimension(700, 525));
      this.getContentPane().add(jPanel1, BorderLayout.CENTER);
      jPanel1.add(jScrollPane1, BorderLayout.CENTER);
      jScrollPane1.getViewport().add(jEditorPane1, null);
      //simple scroll mode doesn't fix it
      //jScrollPane1.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
      this.getContentPane().add(jPanel2, BorderLayout.SOUTH);
      jPanel2.add(jbClose, null);
      URL url = HelpFrame.class.getResource("/com/bwy/help/index.html");
      jEditorPane1.setPage(url);
      jEditorPane1.addHyperlinkListener(this);
      }

      void jbClose_actionPerformed(ActionEvent e) {
      this.hide();
      this.dispose();
      }

      public void show() {
      //Center the window
      Dimension thisSize = this.getSize();
      Dimension frmSize = parent.getSize();
      Point loc = parent.getLocation();
      this.setLocation((frmSize.width - thisSize.width) / 2 + loc.x, (frmSize.height -
      thisSize.height) / 2 + loc.y);
      super.show();
      }

      public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
      if (e instanceof HTMLFrameHyperlinkEvent) {
      HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
      HTMLDocument doc = (HTMLDocument) jEditorPane1.getDocument();
      doc.processHTMLFrameHyperlinkEvent(evt);
      }
      else {
      try {
      jEditorPane1.setPage(e.getURL());
      }
      catch (Throwable t) {
      JOptionPane.showMessageDialog(this, e.getURL() + " not found ", null,
      JOptionPane.ERROR_MESSAGE);
      }
      }
      }
      }

      }
      ---------- END SOURCE ----------
      (Review ID: 181375)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              naasunw Naa Naa (Inactive)
              Reporter:
              jkimsunw Jeffrey Kim (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: