Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Canvas 
 

As the name indicates a Canvas is a region where you can draw things such as circles, triangles, ovals or any other shape. Basically it is a graphical component that represents a region.

 

Canvas

                         

As the name indicates a Canvas is a region where you can draw things such as circles, triangles, ovals or any other shape. Basically it is a graphical component that represents a region. It has got a default method which is paint() method. Canvas class can be sub classed to override this default method to define your own components as shown below in the example. 

<<<<<<< canvas.Shtml

 

 

=======

 

>>>>>>> 1.2
import java.awt.*;
import java.applet.*;
 
public class MyCanvas extends Applet { 
  public MyCanvas() { 
      setSize(8040); 
  
  public void paint(Graphics g) { 
  g.drawRect(009050);  
    g.drawString("A Canvas"15,15); 
  

Here is the Output:

C:\newprgrm>javac MyCanvas.java

C:\newprgrm>appletviewer MyCanvas.html

 

 

Download this example.

                         

» View all related tutorials
Related Tags: c class make method sed boolean value ole set oo frame if boo to ram bool argument e il not

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

2 comments so far (
post your own) View All Comments Latest 10 Comments:

give me u r mail id i vil send u the source code of mine, which i wrote for 9sq puzzle game........

Posted by radan on Wednesday, 06.4.08 @ 21:48pm | #62111

I am soumya.. I am actually trying to create
a 15-sqare puzzle. But i can understand how to generate event i.e. how to mave a component
within the applet.. pls help..

Posted by soumya prasad ukil on Friday, 01.11.08 @ 16:32pm | #44978

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.