如何从小程序打开新的小程序窗口 [英] How to open new applet window from a applet
本文介绍了如何从小程序打开新的小程序窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从小程序本身打开一个新的小程序窗口?
how can i open a new applet window from a applet itself?
推荐答案
打开一个新的 Java 窗口 (JFrame
) 来自小程序,请参阅以下摘自 Java 教程:
//1. Create the frame.
JFrame frame = new JFrame("FrameDemo");
//2. Optional: What happens when the frame closes?
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//3. Create components and put them in the frame.
//...create emptyLabel...
frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
//4. Size the frame.
frame.pack();
//5. Show it.
frame.setVisible(true);
打开一个包含小程序的新浏览器窗口 showDocument(URL, "_blank")
:
URL url = new URL(getCodeBase().getProtocol(),
getCodeBase().getHost(),
getCodeBase().getPort(),
"/next.html");
getAppletContext().showDocument(url, "_blank");
这篇关于如何从小程序打开新的小程序窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文