⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getparamapplet.java

📁 java的一系列产品中包括jsme,jmse,j2ee,本文件提供j2ee实现的源代码.
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.net.*;

/*try{
	getAppletContext().showDocument
	(new URL("http://localhost:7001/servletsample/HelloWorld2"),"_blank");
}catch (Exception ex) {}
*/

public class getParamApplet extends Applet{
	String link1,link2;
	boolean badURL;
	public void init(){
		GridLayout layout=new GridLayout(1,2,5,5);
		setLayout(layout);
		Font fnt=new Font("TimesRoman",Font.PLAIN,12);
		setFont(fnt);
		Button butt=new Button("Sohu");
		add(butt);
		butt=new Button("Local");
		add(butt);		
		link1=getParameter("link1");
		link2=getParameter("link2");		
		badURL=false;
	}
  
	public void paint(Graphics g){
		if(badURL)
			g.drawString("badURL",20,20);
	}
	
	public boolean action(Event evt,Object arg){
		String str;
		if(arg=="Sohu")	
			str=link1;
		else if(arg=="Local")
			str=link2;
		else
		  str="error str";
		try{
			URL url=new URL(str);
			AppletContext context=getAppletContext();
			context.showDocument(url);
		}catch(MalformedURLException e){
		  badURL=true;
		  repaint();
		}
		return true;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -