Headlines News :
Home » , » Basic Applet Program in Java

Basic Applet Program in Java




This program is only for beginners in Java. Following program just gives you a gist of how an Applet must look like and what is the basic structure. There are actually five phases in an applet which are not explicitly shown here. The width and height values must be given and there are no default values which will automatically be taken by the compiler. The paint () method is the one which is capable of displaying anything onto the screen.



// APP.JAVA

// SIMPLE APPLET PROGRAM
// Created by Ankit Jain on 20/4/2013.
// Copyright 2010, Ankit Jain . All rights reserved.
// The copyright to the computer program(s) herein
// is the property of Ankit jain, India. The
// program(s) may be used and/or copied only with the
// written permission of Ankit Jain or in accordance
// with the terms and conditions stipulated in the
// agreement/contract under which the program(s) have
// been supplied. This copyright notice must not be
// removed.
// Published in studentsfriend.in
import java.applet.*;
import java.awt.*;
//
public class appdraw extends Applet
{
public void paint(Graphics g)
{
g.drawRect(10, 60, 30, 50);
}
}


Copy Code Form here 

// APP.JAVA
// SIMPLE APPLET PROGRAM
// Created by Ankit Jain on 20/4/2013.
// Copyright 2010, Ankit Jain . All rights reserved.
// The copyright to the computer program(s) herein
// is the property of Ankit jain, India. The
// program(s) may be used and/or copied only with the
// written permission of Ankit Jain or in accordance
// with the terms and conditions stipulated in the
// agreement/contract under which the program(s) have
// been supplied. This copyright notice must not be
// removed.
// Published in studentsfriend.in
import java.applet.*;
import java.awt.*;
//
public class appdraw extends Applet
{
public void paint(Graphics g)
{
g.drawRect(10, 60, 30, 50);
}
}
Share this post :
 
Support : Worldwide Solution | Intense Dealz | Your Link
Copyright © 2013. Students Friend - All Rights Reserved
Website maintained by Ankit Jain And Akhil Dadhich
Proudly powered by WWS INDIA