当前位置: 技术问答>java相关
再次有劳各位JJ,GG,MM,DD,给看看一个小程序!先谢过各位!
来源: 互联网 发布时间:2015-01-10
本文导语: 下面是我的程序: //Pump.java package bumf; import java.applet.Applet; import java.applet.AppletContext; public class Pump extends Applet { public static Pump selRef = null; private LookFor1 tmp; public void init() { selRef = this; tmp = new LookF...
下面是我的程序:
//Pump.java
package bumf;
import java.applet.Applet;
import java.applet.AppletContext;
public class Pump extends Applet
{
public static Pump selRef = null;
private LookFor1 tmp;
public void init()
{
selRef = this;
tmp = new LookFor1();
tmp.setBounds(0,0,800,600);
tmp.show();
}
public void start()
{
}
}
//LookFor1.java
package bumf;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.beans.*;
/**
*@author:GuoCX
*@descriptor:公文关键词搜索,排序,时间和类别的调整
*Time:2000:6:21
*/
public class LookFor1 extends Frame
{
private Pump m_Ref = null;
private Panel m_panel = new Panel();
public LookFor1()
{
super("公文管理器");
setLayout(new BorderLayout());
add(m_panel,"Center");
addWindowListener(new WindowAdapter()
{
public void windowClosing (WindowEvent event)
{
dispose();
System.exit(0);
}
});
m_Ref = Pump.selRef;
addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e)
{
try{
m_Ref.getAppletContext().showDocument(new URL("http://10.109.41.6"),"_blank");
}
catch(java.net.MalformedURLException ex)
{
System.out.println("java.net.Malf:" + ex.getMessage());
}
}
});
}
}
//测试.html
运行测试.html,弹出一个Frame,点击无反应(我原想点击Frame时测试.html该显示http://10.109.41.6的内容).运行在IE5+WIN2000环境下.
另外,象这种Applet该怎么调试?还有,我现在的工作是JSP,很简单,但以后怎么在工作中深入应用java呢?谢谢!
//Pump.java
package bumf;
import java.applet.Applet;
import java.applet.AppletContext;
public class Pump extends Applet
{
public static Pump selRef = null;
private LookFor1 tmp;
public void init()
{
selRef = this;
tmp = new LookFor1();
tmp.setBounds(0,0,800,600);
tmp.show();
}
public void start()
{
}
}
//LookFor1.java
package bumf;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.beans.*;
/**
*@author:GuoCX
*@descriptor:公文关键词搜索,排序,时间和类别的调整
*Time:2000:6:21
*/
public class LookFor1 extends Frame
{
private Pump m_Ref = null;
private Panel m_panel = new Panel();
public LookFor1()
{
super("公文管理器");
setLayout(new BorderLayout());
add(m_panel,"Center");
addWindowListener(new WindowAdapter()
{
public void windowClosing (WindowEvent event)
{
dispose();
System.exit(0);
}
});
m_Ref = Pump.selRef;
addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e)
{
try{
m_Ref.getAppletContext().showDocument(new URL("http://10.109.41.6"),"_blank");
}
catch(java.net.MalformedURLException ex)
{
System.out.println("java.net.Malf:" + ex.getMessage());
}
}
});
}
}
//测试.html
运行测试.html,弹出一个Frame,点击无反应(我原想点击Frame时测试.html该显示http://10.109.41.6的内容).运行在IE5+WIN2000环境下.
另外,象这种Applet该怎么调试?还有,我现在的工作是JSP,很简单,但以后怎么在工作中深入应用java呢?谢谢!
|
在 Applet 中很难访问不是源服务器的其他URL地址的内容的,是由浏览器的安全模型所限制的。