JavaApplet嵌入html,打开html时为什么会弹出一个applet窗口。
本应该直接在html里显示的,打开html时竟然弹出了一个小的applet执行框。
html的代码
<html>
<head>
<title>ImageJA Applet</title>
</head>
<body bgcolor=gray>
<h1>ImageJ embedded in a website</h1>
<applet codebase="." code="ij.ImageJApplet.class" width=750 height=550></applet>
</body>
</html>
在ij目录下有对应的class文件。
本应该直接在html里显示的,打开html时竟然弹出了一个小的applet执行框。
html的代码
<html>
<head>
<title>ImageJA Applet</title>
</head>
<body bgcolor=gray>
<h1>ImageJ embedded in a website</h1>
<applet codebase="." code="ij.ImageJApplet.class" width=750 height=550></applet>
</body>
</html>
在ij目录下有对应的class文件。
解决方案 »
- java调用C++的dll出现堆栈溢出错误
- 关于属小母牛的问题 改了一下cow.grow();的位置,结果咋就不一样了啊 ,想不明白啊 (从网上找的一个例子)
- 怎么自己设定监听器
- 介绍一个java电子书的网站
- 执行到JOptionPane弹出消息框,程序会停止??
- 我想用UML描述一个文件系统,想征集一些构思!
- 计算得到的Double型小数点后位数太长了,如何修改它的精度只保留到小数点后两位?
- java.text.NumberFormat 格式化数值 四舍五入问题, 求解
- this.addNotify()是什么功能呢?
- 急!!!谁有RTF文件格式中元素说明?给一份!谢先!!!!70分奉上!
- session失效,jsp页面怎样给出提示????????????
- 大学计算机教的东西是不是太枯燥了?
LZ,你将那个ImageJApplet代码发过来看下。。
public void init() {
ImageJ ij = IJ.getInstance();
if (ij==null || (ij!=null && !ij.isShowing()))
new ImageJ(this);
for (int i=1; i<=9; i++) {
String url = getParameter("url"+i);
if (url==null) break;
ImagePlus imp = new ImagePlus(url);
if (imp!=null) imp.show();
}
}
public void destroy() {
ImageJ ij = IJ.getInstance();
if (ij!=null) ij.quit();
}}
package ij;import java.applet.Applet;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.awt.image.*;
import ij.gui.*;
import ij.process.*;
import ij.io.*;
import ij.plugin.*;
import ij.plugin.filter.*;
import ij.plugin.frame.*;
import ij.text.*;
import ij.macro.Interpreter;
import ij.io.Opener;
import ij.util.*;
public class ImageJ extends Frame implements ActionListener,
MouseListener, KeyListener, WindowListener, ItemListener, Runnable { /** Plugins should call IJ.getVersion() to get the version string. */
public static final String VERSION = "1.42p";
public static Color backgroundColor = new Color(220,220,220); //224,226,235
/** SansSerif, 12-point, plain font. */
public static final Font SansSerif12 = new Font("SansSerif", Font.PLAIN, 12);
/** Address of socket where Image accepts commands */
public static final int DEFAULT_PORT = 57294;
public static final int STANDALONE=0, EMBEDDED=1; private static final String IJ_X="ij.x",IJ_Y="ij.y";
private static int port = DEFAULT_PORT;
private static String[] arguments;
private Toolbar toolbar;
private Panel statusBar;
private ProgressBar progressBar;
private Label statusLine;
private boolean firstTime = true;
private java.applet.Applet applet; // null if not running as an applet
private Vector classes = new Vector();
private boolean exitWhenQuitting;
private boolean quitting;
private long keyPressedTime, actionPerformedTime;
private String lastKeyCommand;
private boolean embedded;
private boolean windowClosed;
boolean hotkey;
/** Creates a new ImageJ frame that runs as an application. */
public ImageJ() {
this(null, EMBEDDED);
}
/** Creates a new ImageJ frame that runs as an applet. */
public ImageJ(java.applet.Applet applet) {
this(applet, 1);
} public ImageJ(java.applet.Applet applet, int mode) {
super("ImageJ");
embedded = applet==null && mode==EMBEDDED;
this.applet = applet;
String err1 = Prefs.load(this, applet);
if (IJ.isLinux()) {
backgroundColor = new Color(240,240,240);
setBackground(backgroundColor);
}
Menus m = new Menus(this, applet);
String err2 = m.addMenuBar();
m.installPopupMenu(this);
setLayout(new GridLayout(2, 1));
// Tool bar
toolbar = new Toolbar();
toolbar.addKeyListener(this);
add(toolbar); // Status bar
statusBar = new Panel();
statusBar.setLayout(new BorderLayout());
statusBar.setForeground(Color.black);
statusBar.setBackground(backgroundColor);
statusLine = new Label();
statusLine.setFont(SansSerif12);
statusLine.addKeyListener(this);
statusLine.addMouseListener(this);
statusBar.add("Center", statusLine);
progressBar = new ProgressBar(120, 20);
progressBar.addKeyListener(this);
progressBar.addMouseListener(this);
statusBar.add("East", progressBar);
statusBar.setSize(toolbar.getPreferredSize());
add(statusBar); IJ.init(this, applet);
addKeyListener(this);
addWindowListener(this);
setFocusTraversalKeysEnabled(false);
Point loc = getPreferredLocation();
Dimension tbSize = toolbar.getPreferredSize();
int ijWidth = tbSize.width+10;
int ijHeight = 100;
setCursor(Cursor.getDefaultCursor()); // work-around for JDK 1.1.8 bug
if (IJ.isWindows()) try {setIcon();} catch(Exception e) {}
setBounds(loc.x, loc.y, ijWidth, ijHeight); // needed for pack to work
setLocation(loc.x, loc.y);
pack();
setResizable(!(IJ.isMacintosh() || IJ.isWindows())); // make resizable on Linux
if (err1!=null)
IJ.error(err1);
if (err2!=null) {
IJ.error(err2);
IJ.runPlugIn("ij.plugin.ClassChecker", "");
}
if (IJ.isMacintosh()&&applet==null) {
Object qh = null;
qh = IJ.runPlugIn("MacAdapter", "");
if (qh==null)
IJ.runPlugIn("QuitHandler", "");
}
if (applet==null)
IJ.runPlugIn("ij.plugin.DragAndDrop", "");
m.installStartupMacroSet();
String str = m.getMacroCount()==1?" macro)":" macros)";
String java = "Java "+System.getProperty("java.version")+(IJ.is64Bit()?" [64-bit]":" [32-bit]");
IJ.showStatus("ImageJ "+VERSION + "/"+java+" ("+ m.getPluginCount() + " commands, " + m.getMacroCount() + str);
if (applet==null && !embedded && Prefs.runSocketListener)
new SocketListener();
configureProxy();
show();
}
void configureProxy() {
String server = Prefs.get("proxy.server", null);
if (server==null||server.equals("")) return;
int port = (int)Prefs.get("proxy.port", 0);
if (port==0) return;
String user = Prefs.get("proxy.user", null);
Properties props = System.getProperties();
props.put("proxySet", "true");
props.put("http.proxyHost", server);
props.put("http.proxyPort", ""+port);
if (user!=null)
props.put("http.proxyUser", user);
//IJ.log(server+" "+port+" "+user);
}
.....
谢谢各位的支持,非常着急,已经拖了两天了。