Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Java: Draw rectangle, ovale and line

Java: Draw rectangle, ovale and line
{filelink=9428}

   import java.awt.Color;
   import java.awt.Graphics;
   import javax.swing.*;
   public class GEOGraph extends JPanel
   {
    public void paintComponent( Graphics g )
    {
       super.paintComponent( g ); 
       this.setBackground( Color.WHITE );
       g.setColor( Color.BLUE );
       g.drawLine( 5, 30, 380, 30 );
       g.setColor( Color.RED );
       g.drawRect( 5, 40, 90, 55 );
       g.fillRect( 100, 40, 90, 55 );
       g.setColor( Color.MAGENTA );
       g.draw3DRect( 5, 100, 90, 55, true );
       g.fill3DRect( 100, 100, 90, 55, false );
       g.setColor( Color.green );
       g.drawOval( 195, 100, 90, 55 );
       g.fillOval( 290, 100, 90, 55 );
    }
    	// Fonction principale
    	public static void main (String[] args)
    		{
    		 JFrame frame=new JFrame("Java Drawing")	;
    		 JPanel policePanel=new GEOGraph();
    		 frame.add(policePanel);
    		 frame.setSize(300,200);
    		 frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
    		 frame.setVisible(true);
            }
 }

Users who found this page were searching for:

  • java draw rectangle line
  • java rectangle exemple
  • get current date using gregorian calendar in java
  • 128 toBinary number
  • java 3d rectangle
  • java cancel draw line
  • mail creatimage.com loc:US
  • regex java sub group plus
  • add image component in java
  • alarm example perl

No comments yet.

Leave a Comment