.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Code Snippets >> OOPS >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Line drawing using java applet.

Posted By:laptop charles       Posted Date: June 30, 2010    Points: 10    Category: OOPS    URL: http://www.dotnetspark.com  

Draw line.

Java applet to draw the line.
It is very simple concept.
//Drawing Lines
//Here's the source code for a first applet: 
import java.applet.*;
import java.awt.*;

public class app4 extends Applet {

   int width, height;

   public void init() {
      width = getSize().width;
      height = getSize().height;
      setBackground( Color.black );

   public void paint( Graphics g ) {
      g.setColor( Color.green );
      for ( int i = 0; i < 30; ++i ) {
         g.drawLine( width, height, i * width / 10, 0 );


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend