How To Implement Graphics In Java
Rate this article
0 out of 5
In this tutorial we will show you how to implement graphics in java. After viewing the video tutorial, download the source code and try to modify the code so as to get a feel of what is learned in this video tutorial.


Source Code
paintTest.java
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class paintTest extends JFrame 
{
   public paintTest() 
   {
      super( "paintTest Demo" );
      setSize( 400, 130 );
      show();
   }

   public void paint( Graphics g ) 
   {
      g.setColor( new Color( 255, 255, 0 ) );
      g.drawString( "JAVA AND GRAPHICS CONTEXT EXAMPLE             " + g.getColor(), 100,100 );
   }

   public static void main( String args[] ) 
  {
      paintTest app = new paintTest();

        app.addWindowListener(
         new WindowAdapter()
           {
            public void windowClosing( WindowEvent e )
            {
               System.exit( 0 );
            }
         }
      );
   }
}


Source Code

About The Author
TekTips Videos

Number Of articles Posted      : 27
Number Of Messages Posted  : 0
Joined Date : 2013/2/04
   
Author
Messages
Posted:
Post Your Comments  
Name (Max 50 Chars)
Comments
 
 

 
TekTipsDownload
GateExam
Academic Projects
TekTipsExperts
Android