Java小程序窗口的大小在Eclipse [英] Java Applet Windows size in Eclipse

查看:1020
本文介绍了Java小程序窗口的大小在Eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用500设置一个小程序窗口500的大小,但我无法做到这一点。
这里是我的code,

I am trying to set the size of an Applet Window to 500 by 500, but I couldn't be able to achieve that. Here is my code,

  public void init() { 
    // Start Screen Color 
    setBackground(Color.RED);
    this.setSize(new Dimension(500,500));

    width=getSize().width;
    height=getSize().height;

    running=false;
    repaint();
    offscreenImage = createImage(width,height);
    offscreenGraphics = offscreenImage.getGraphics();
    addKeyListener(this);    
    addFocusListener(this);

    waitingForSpace=false;

    repaint();
  }

当我pressed CTRL在Eclipse + F11我用200减500的大小而一些得到的输出窗口大小为200,为什么我尝试运行该程序像5至10倍,有时与500的窗口返回时间窗口大小为200 200。

When I pressed CTRL+F11 in Eclipse I get the output Window with size 200 by 200, Why I try to run the program like 5 to 10 times, sometimes the window returns with the 500 by 500 size while some time the window size is 200 by 200.

我不明白为什么窗口的大小改变我,因为我没有改变任何code在所有。
我要的大小500保持在500

I do not understand why the size of the window i changing since I am not changing any code at all. I want the size to remain at 500 by 500

推荐答案

如果你使用Eclipse,你可以从运行配置的Java Applet->参数改变applet的大小。我认为这是问题,因为默认值爪哇在eclipse小程序大小为200 * 200。

If you use eclipse, you can change applet size from the "run configuration" Java Applet->Parameters". I think that's the problem, because the default value of java applet size in eclipse is 200*200.

希望这将有所帮助:
<一href=\"http://stackoverflow.com/questions/4759499/changing-the-size-for-my-applet-also-in-eclipse-run-as-applet\">a类似的问题

这篇关于Java小程序窗口的大小在Eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆