Java Applet上的问题 [英] Problem on java Applet

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

问题描述

Hii,



我目前正在研究java applet,我遇到的问题是如果窗口的大小为800 * 480(使用setSize设置) ())可见区域保持较小。到目前为止,我的代码是



Hii,

I am currently working on java applet and i am encountered with a problem that If the window has the size of 800*480 (set with setSize()) the visible area stays small.My code so far is

import java.applet.Applet;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;

public class StartingClass extends Applet implements Runnable {
	@Override
	public void init() {
		setSize(800,480);
		
		setFocusable(true);
		Frame frame=(Frame)this.getParent().getParent();
		frame.setTitle("Q-Bot Alpha");
		setBackground(Color.BLACK);
		//frame.setBackground(Color.BLACK);

	}
	

	@Override
	public void start() {
		Thread thread = new Thread(this);
		thread.start();

	}

	@Override
	public void stop() {

	}

	@Override
	public void destroy() {

	}

	@Override
	public void run() {
		while (true) {
			repaint();
			try {
				Thread.sleep(17);
			} catch (InterruptedException e) {

				e.printStackTrace();
			}
		}

	}

}



我缺少什么?


what i am missing?

推荐答案

请参阅 http: //stackoverflow.com/questions/19367320/java-applet-windows-size-is-not-increasing [ ^ ]。


这篇关于Java Applet上的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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