【问题标题】:JEditorPane - IMG tag without HEIGHT parameterJEdi​​torPane - 没有 HEIGHT 参数的 IMG 标记
【发布时间】:2011-07-08 18:21:09
【问题描述】:

在带有 html 内容的 JEditorPane 中:

...
<img src="x.jpg" width="100" border="0" />
...

(例如图像是(500x700))

Firefox 或 chrome 或任何其他浏览器在页面上将此图像视为 100x140

(140 = 700 / (500/100))

但是 JEdi​​torPane 将其显示为 100x20(我认为 20 是默认值)。 这是一个错误吗?

我能做什么,我不能更改 html 源,因为它在 CD-ROM 上。

提前致谢

福尔坎

编辑:引用的html文件内容:

<html msxsl="urn:schemas-microsoft-com:xslt" user="http://www.etiam.com/namespace" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Windows (vers 12 April 2005), see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<title></title>

</head>
<body vlink="#ffff00" style="background-color: rgb(0, 0, 0)" alink="#ffff00" link="#ffff00">
<h1>
  <u>PAT 143</u>
</h1>
<h2>
  ID : 100043
</h2>
<h2>
  Birthdate : 2001/01/01
</h2>
<br>


<ul>
  <li>
    Study date: 2005/01/01 00:00<br><br>
  </li>
  <li style="list-style-position: outside; list-style-type: none; list-style-image: none">
    <table border="0" width="90%" align="center">
      <tr>
        <td align="center">
          <a href="aa1.htm"><img src="0.jpg" border="0" width="128">
          </a>
        </td>
        <td align="center">
          <a href="aa2.htm"><img src="3.jpg" border="0" width="128">
          </a>
        </td>
        <td align="center">
          <a href="aa3.htm"><img src="5.jpg" border="0" width="128">
          </a>
        </td>
      </tr>
    </table>
    <p align="center">
      click an image to select a series
    </p>
  </li>
</ul>
<br>
<br>
<br>


<p align="center">
  <a href="/index.htm"><img src="retacc.gif" border="0">
</a>    </p>
</body>
</html>

【问题讨论】:

  • 在你的情况下,行高是 20 吗?
  • 我用 html 文件编辑了消息。
  • 你能发布 sscce (sscce.org) 吗?

标签: java html swing


【解决方案1】:

Firefox 或 chrome 或任何其他浏览器在页面上将此图像视为 100x140

FF 和 Chrome 如何处理无效 HTML 是他们的事。

但 JEditorPane 将其显示为 100x20(我认为 20 是默认值)。这是一个错误吗?

不,除非您指的是 HTML 中的“错误”。 GI/GO。

【讨论】:

  • 你的意思是什么?在某一阶段,几乎 50% 的 IE 代码用于处理格式错误的 HTML。 浏览器制造商让浏览器根据原始图像对原始图像进行“比例缩放”也就不足为奇了提供单一尺寸属性。但是 JEditorPane 是一个完全“功能不同”的 HTML 渲染器 - 非常小巧轻便,几乎无法纠正源文档中的错误。 JEP 从未打算用作完整的浏览组件。
猜你喜欢
  • 2014-09-15
  • 1970-01-01
  • 2012-03-14
  • 2011-06-06
  • 2014-06-30
  • 2011-04-11
  • 1970-01-01
  • 2012-03-11
  • 2011-08-20
相关资源
最近更新 更多