java高手请进 如何在窗体中嵌入网页? 需要在窗体里嵌入网页,有这样的控件吗?小弟实在没分,多包涵,先谢过! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请教2楼大哥那在html里的超链接和其它的按钮等功能是不是也能实现啊? 可以的,JEditorPane只支持html和rtf,可以用来浏览简单的html文档 不行啊,超链接能显示出来,可是按钮不能显示。只显示‘>’个。窗体源代码:package Frame;import java.awt.Color;import java.io.IOException;import java.net.URL;import java.net.URLClassLoader;import javax.swing.*;public class FrameOne extends JFrame { public FrameOne() throws IOException{ JEditorPane EditorPane= new JEditorPane(); URL url = this.getClass().getResource("/Frame/help.html"); EditorPane.setEditable(false); EditorPane.setPage(url); this.add(EditorPane); }}HTML源代码:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>Index page!!!!</title></head><body> <table width="200" border="1" align="center"> <tr> <td align="center"><input type="button" value="请点击"/></td> </tr> <tr> <td align="center"><input type="button" value="请点击"/></td> </tr> <tr> <td align="center"><input type="button" value="请点击"/></td> </tr></table> <p><a href="test.html">111111111111</a></p></body></html>主函数源代码:package Main;import java.io.IOException;import Frame.FrameOne;public class MainTest { public static void main(String[] args) throws IOException { FrameOne fo = new FrameOne(); fo.setSize(new Dimension(800,600)); fo.setVisible(true); }}结果: 没错,JEditorPane可以。也可以用JNI内嵌一个IE浏览器,不过这会破坏Java程序移植性,除非只在Windows上运行。 学习jstatd的问题 关于equals的讨论,大家来讨论下。 一个很简单的JAVA题目,也很重要,帮我看下怎么写,我只写了一部分!在线等~~ 有谁知道c#中numericUpDown这个控件在java里面是哪个控件? JAVA新手,学到"容器",遇到问题了....帮帮我吧... 高手帮忙解决下数据库的问题 字符转换成16进制的数组 java安装了以后,它的类库在哪啊? applet 数字签名 我是JAVA新手,我安装了JDK1.7系统变量也配置好了,但是为什么我在运行窗口里输入javac却显示'javac'不是内部或外部命令 jdbc与sql数据库的连接问题。 请教高手
那在html里的超链接和其它的按钮等功能是不是也能实现啊?
窗体源代码:
package Frame;import java.awt.Color;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import javax.swing.*;public class FrameOne extends JFrame {
public FrameOne() throws IOException{
JEditorPane EditorPane= new JEditorPane();
URL url = this.getClass().getResource("/Frame/help.html");
EditorPane.setEditable(false);
EditorPane.setPage(url);
this.add(EditorPane);
}
}
HTML源代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Index page!!!!</title>
</head>
<body>
<table width="200" border="1" align="center">
<tr>
<td align="center"><input type="button" value="请点击"/></td>
</tr>
<tr>
<td align="center"><input type="button" value="请点击"/></td>
</tr>
<tr>
<td align="center"><input type="button" value="请点击"/></td>
</tr>
</table>
<p><a href="test.html">111111111111</a></p>
</body>
</html>主函数源代码:
package Main;import java.io.IOException;
import Frame.FrameOne;public class MainTest {
public static void main(String[] args) throws IOException {
FrameOne fo = new FrameOne();
fo.setSize(new Dimension(800,600));
fo.setVisible(true);
}
}结果:
也可以用JNI内嵌一个IE浏览器,不过这会破坏Java程序移植性,除非只在Windows上运行。