1、首先你要保证你的电脑上已经安装好了Java,我们打开开始,看下所有程序中是否已经安装java。
2、点击“检查更新”检查下Java版本是否为最新版本,如果不是就更新为最新版本。
3、然后我们选择“配置java”,在安全选项中把“启用浏览器中的java”勾选上。
4、然后我们打开浏览器,在工具中找到“internet选项”点击打开。
5、在“安全”选项中找到“自定义级别”点击打开。
6、在脚本下面找到“Java小程序脚本”勾选“启用”,配置好之后重新启动浏览器即可。
// 很鸡肋的简易浏览器 输入http://www.baidu.com试试吧import javax.swing.*
import java.awt.*
import java.awt.event.*
import java.net.*
import java.io.*
import javax.swing.event.*
@SuppressWarnings("serial")
class Win3 extends JFrame implements ActionListener,Runnable
{
JButton button
URL url
JTextField text
JEditorPane editPane
byte b[]=new byte[118]
Thread thread
public Win3()
{
text=new JTextField(20)
editPane=new JEditorPane()
editPane.setEditable(false)
button=new JButton("确定")
button.addActionListener(this)
thread=new Thread(this)
JPanel p=new JPanel()
p.add(new JLabel("输入网址:"))
p.add(text)
p.add(button)
Container con=getContentPane()
con.add(new JScrollPane(editPane),BorderLayout.CENTER)
con.add(p,BorderLayout.NORTH)
setBounds(60,60,400,300)
setVisible(true)
validate()
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
editPane.addHyperlinkListener(new HyperlinkListener()
{
public void hyperlinkUpdate(HyperlinkEvent e)
{
if(e.getEventType()==
HyperlinkEvent.EventType.ACTIVATED)
{
try{
editPane.setPage(e.getURL())
}
catch(IOException e1)
{
editPane.setText(""+e1)
}
}
}
}
)
}
public void actionPerformed(ActionEvent e)
{
if(!(thread.isAlive()))
thread=new Thread(this)
try{
thread.start()
}
catch(Exception ee)
{
text.setText("我正在读取"+url)
}
}
public void run()
{
try {
int n=-1
editPane.setText(null)
url=new URL(text.getText().trim())
editPane.setPage(url)
}
catch(MalformedURLException e1)
{
text.setText(""+e1)
return
}
catch(IOException e1)
{
text.setText(""+e1)
return
}
}
}
public class Example3
{
public static void main(String args[])
{
new Win3()
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)