java applet

java applet

Page 1 of 1

1 Replies - 1958 Views - Last Post: 13 March 2009 - 08:21 PM Rate Topic: -----

#1 deleon_chesterhomer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 184
  • Joined: 08-September 07

java applet

Posted 13 March 2009 - 04:20 PM

 import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class testing extends Applet implements Runnable

{
	/**
	 * 
	 */
	private static final long serialVersionUID = 6747312521208653906L;
	
	
	int x =0,width,height;
	//Image picture;
	Thread t;
	AudioClip s1;
	MediaTracker mt;
	Image car,stop_light,go_light,yellow_light;
	Button btnEnter;
	Cursor pointer;

	
	public void init()
	{
		setLayout(new FlowLayout(FlowLayout.CENTER,20,20));
		System.out.println("method init():");
		width = getSize().width;
		height = getSize().height;
	//	Button btnEnter = new Button("ENTER");
	//	add(btnEnter);
	//	btnEnter.addActionListener(this);
	//	setBackground(Color.BLUE);
		
		
	
		
		
		
		
		
	}
	
	public void destroy()
	{
		System.out.println("method start():");
	}
	
	
	public void start()
	{
		System.out.println("method start():creating thread");
		t = new Thread(this);
		t.start();		
	}
	
	public void stop()
	{
		System.out.println("method stop():");
	}
	public void run()
	{
		
		//mt = new MediaTracker(this);
		//pic = getImage(getDocumentBase(),"/family.jpg");
		//mt.addImage(pic,1);
		
		/*while(true)
		{
			System.out.println("method run():awake");
			x++;
			if(x>3)
				x = 0;
			showStatus("x is "+x);
			System.out.println("method run():requesting repaint");
			repaint();
			try
			{
				System.out.println("method run():  sleeping");
				t.sleep(500);
			}
			catch(InterruptedException e){}
			
		}*/
	}
	
	public void update(Graphics chest)
	{
		System.out.println("method update():");
		paint(chest);
	}
	
	public void paint(Graphics chest)
	{
		
		
		

		car = createImage(110,400);
		Graphics c = car.getGraphics();
		c.setColor(Color.black);
		c.fillRect(70,420, 150, 50);
		
		chest.drawImage(car,0,0,this);
	  }
}
		  
i can't see the object i created

Is This A Good Question/Topic? 0
  • +

Replies To: java applet

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8329
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: java applet

Posted 13 March 2009 - 08:21 PM

Naming a topic "Java Applet" in a site devoted to Java is not really a good idea and does not give us a clue of what your problem is

Which object you can't see ?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1