Click here to Skip to main content
15,885,998 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

Java
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?
Posted
Updated 24-Jul-14 0:54am
v2

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900