| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1131 人关注过本帖
标题:[求助]为什么JSP调用APPLET显示不了图呢?
只看楼主 加入收藏
lzf0112
Rank: 1
等 级:新手上路
帖 子:244
专家分:0
注 册:2006-4-9
收藏
 问题点数:0 回复次数:0 
[求助]为什么JSP调用APPLET显示不了图呢?

我通过一个JSP页面调用APPLET,在浏览JSP时该现实APPLET的地方却没有图出现啊,为什么?
APPLET代码为
package four;

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.JPanel;
import java.awt.Rectangle;
import javax.swing.JSplitPane;
import com.esri.mo2.ui.bean.Map;
import com.esri.mo2.ui.bean.Layer;
import com.esri.mo2.ui.bean.*;
import javax.swing.JToolBar;
import javax.swing.JButton;
import javax.swing.*;

public class Applet1 extends Applet {
boolean isStandalone = false;
BorderLayout borderLayout1 = new BorderLayout();
CardLayout cardLayout1 = new CardLayout();
JSplitPane jSplitPane1 = new JSplitPane();
Map map1 = new Map();
Layer layer1 = new Layer();
JToolBar jToolBar1 = new JToolBar();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
JButton jButton4 = new JButton();
JButton jButton5 = new JButton();
JButton jButton6 = new JButton();
JButton jButton7 = new JButton();
JButton jButton8 = new JButton();
//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}

//Construct the applet
public Applet1() {
}

//Initialize the applet
public void init() {
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
}

//Component initialization
private void jbInit() throws Exception {
this.setLayout(cardLayout1);
layer1.setDataset(
"com.esri.mo2.src.file.FileSystemConnection!E:/毕设/图/学校.shp!");
layer1.setBounds(new Rectangle(145, 92, 32, 32));
jToolBar1.setOrientation(JToolBar.VERTICAL);
jButton1.setToolTipText("放大");
jButton1.setText("jButton1");
jButton2.setToolTipText("缩小");
jButton2.setText("jButton2");
jButton3.setToolTipText("全景显示");
jButton3.setText("jButton3");
jButton4.setToolTipText("移动");
jButton4.setText("jButton4");
jButton5.setToolTipText("画框查询");
jButton5.setText("jButton5");
jButton6.setToolTipText("地图标注");
jButton6.setText("jButton6");
jButton7.setToolTipText("鹰眼地图");
jButton7.setText("jButton7");
jButton8.setToolTipText("地图测量");
jButton8.setText("jButton8");
this.add(jSplitPane1, "jSplitPane1");
jSplitPane1.add(map1, JSplitPane.RIGHT);
map1.add(layer1);
jSplitPane1.add(jToolBar1, JSplitPane.LEFT);
jToolBar1.add(jButton1);
jToolBar1.add(jButton2);
jToolBar1.add(jButton3);
jToolBar1.add(jButton4);
jToolBar1.add(jButton5);
jToolBar1.add(jButton6);
jToolBar1.add(jButton7);
jToolBar1.add(jButton8);
jSplitPane1.setDividerLocation(80);
}

//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}

//Get parameter info
public String[][] getParameterInfo() {
return null;
}

//Main method
public static void main(String[] args) {
Applet1 applet = new Applet1();
applet.isStandalone = true;

Frame frame;
frame = new Frame();
frame.setTitle("Applet Frame");

frame.add(applet, BorderLayout.CENTER);

applet.init();
applet.start();
frame.setSize(400, 320);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2,
(d.height - frame.getSize().height) / 2);
frame.setVisible(true);
}


}

JSP代码为:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page errorPage="jsp1_error.jsp" %>
<html>
<head>
<title>
jsp1
</title>
</head>
<body bgcolor="#ffffff">
<h1>
JBuilder Generated JSP
</h1>
<form method="post" action="jsp1.jsp">
<br><br>
<applet
codebase = "."
code = "four.Applet1.class"
name = "TestApplet"
width = "600"
height = "600"
hspace = "0"
vspace = "0"
align = "middle"
>
</applet>
<p>
<input type="submit" name="Submit" value="Submit">
<input type="reset" value="Reset">
</form>
</body>
</html>

搜索更多相关主题的帖子: APPLET JSP 
2007-11-16 20:21
快速回复:[求助]为什么JSP调用APPLET显示不了图呢?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026486 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved