java JApplet:设置框架的大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4394702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JApplet: setting the size of the frame
提问by Jason Rogers
I read that this is a tricky question because an applet is run in the browser. But I would like my applet window to always maintain the same size. (Right now working with Eclipse I can slide the size of the window.)
我读到这是一个棘手的问题,因为在浏览器中运行了一个小程序。但我希望我的小程序窗口始终保持相同的大小。(现在使用 Eclipse,我可以滑动窗口的大小。)
For the moment I only do this:
目前我只这样做:
public class myJApplet extends JApplet{
public void init() {
this.setSize(800, 480);
}
}
Is there a way to add a this.setResizable(false)
?
有没有办法添加一个this.setResizable(false)
?
回答by Andrew Thompson
Set the size of the applet in the HTML. E.G.
在 HTML 中设置小程序的大小。例如
<html>
<body>
<applet code="myJApplet" width="800" height="480">
</applet>
</body>
</html>
The applet will still be resizable when the HTML is loaded in the AppletViewer, but that is not relevant to deployment.
当在 AppletViewer 中加载 HTML 时,小程序仍可调整大小,但这与部署无关。