Tuesday, 14 November 2017

jav program circles in rectangles

This is main class


package graphs;
import javax.swing.*;
public class Graphs {

   
    public static void main(String[] args) {
       String title="ALLAH IS ONE";
      
       JFrame f= new JFrame();
       f.setSize(300,390);
       f.setTitle(title);
       paints P= new paints();
       f.add(P);
       f.setVisible(true);
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    }
   
}

After writing main class create a new class of paints

 
package graphs;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;

public class paints extends JComponent {
      public void paint(Graphics g)
    {
       
        Graphics2D g2 = (Graphics2D) g;
        g2.drawString("An intelligent face", 10, 10);
       int i=1,j=1,k=1,l=1;
       for(int h=0;h<20;h++){
    Rectangle R= new Rectangle(i,j,k,l);
    g2.draw(R);
   
       Ellipse2D.Double E=new Ellipse2D.Double(i,j,k,l);
       g2.draw(E);
      
   
    i+=11;j+=9;k+=11;l+=9;
       }


}
}

////////////////////

Output is 


java 3d program A lot of rectangles in circles

This is main class

package graphs;
import javax.swing.*;
public class Graphs {

   
    public static void main(String[] args) {
       String title="ALLAH IS ONE";
      
       JFrame f= new JFrame();
       f.setSize(300,390);
       f.setTitle(title);
       paints P= new paints();
       f.add(P);
       f.setVisible(true);
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    }
   
}


After writing main  class create a new class of paints


package graphs;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;

public class paints extends JComponent {
      public void paint(Graphics g)
    {
        Graphics2D g2 = (Graphics2D) g;
        g2.drawString("An intelligent face", 10, 10);
       int i=1,j=1,k=1,l=1,q=1,w=1,e=1,r=1;
       for(int h=0;h<20;h++){
    Rectangle R= new Rectangle(i,j,k,l);
    g2.draw(R);
   
       Ellipse2D.Double E=new Ellipse2D.Double(q,w,e,r);
       g2.draw(E);
      
    q+=1;w+=2;e+=10;r+=9;
    i+=3;j+=4;k+=5;l+=5;
       }

}
}

Output:

                  

java top ten 3D programs




This is main class
package test;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.ColorModel;
import javax.swing.JFrame;
class Test
{
   public static void main(String args[])
         
   {  String title="ALLAH IS ONE";
       for(int i=0;i<3;i++){
       JFrame f= new JFrame();
       f.setSize(200,300);
       if(i==2)
       f.setTitle(title);
       paint P= new paint();
       f.add(P);
       f.setVisible(true);
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 }
 }}
After the main class create a new class of paint and call it in main class
 


import java.awt.*;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;

public class paint extends JComponent {
    public void paint(Graphics g)
    {
        Graphics2D g2 = (Graphics2D) g;
        g2.drawString("An intelligent face", 10, 10);
       int i=1,j=1,k=1,l=1;
       for(int h=0;h<170;h++){
    Rectangle R= new Rectangle(i,j,k,l);
    g2.draw(R);
    i+=1;j+=1;k++;l++;
       }
}}

Output is 



important graphical user interface in java



This is main class
package test;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.ColorModel;
import javax.swing.JFrame;
class Test
{
   public static void main(String args[])
         
   {  String title="ALLAH IS ONE";
       for(int i=0;i<3;i++){
       JFrame f= new JFrame();
       f.setSize(200,300);
       if(i==2)
       f.setTitle(title);
       paint P= new paint();
       f.add(P);
       f.setVisible(true);
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 }
 }}
After the main class create a new class of paint and call it in main class
                  

package test;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;

public class paint extends JComponent {
    public void paint(Graphics g)
    {
        Graphics2D g2 = (Graphics2D) g;
        g2.drawString("An intelligent face", 10, 10);
       int i=1,j=1,k=1,l=1;
       for(int h=0;h<70;h++){
    Rectangle R= new Rectangle(i,j,k,l);
    g2.draw(R);
    i+=2;j+=2;k++;l++;
       }
}}
  

Output is 

                                

java graphical user interface



This is main class
package test;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.ColorModel;
import javax.swing.JFrame;
class Test
{
   public static void main(String args[])
         
   {  String title="ALLAH IS ONE";
       for(int i=0;i<3;i++){
       JFrame f= new JFrame();
       f.setSize(200,300);
       if(i==2)
       f.setTitle(title);
       paint P= new paint();
       f.add(P);
       f.setVisible(true);
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 }
 }}
After the main class create a new class of paint and call it in main class
        

package test;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;

public class paint extends JComponent {
    public void paint(Graphics g)
    {
        Graphics2D g2 = (Graphics2D) g;
        g2.drawString("An intelligent face", 10, 10);
      
   int i=70,j=99,k=200,l=249;
   for(int h=0;h<13;h++)
   {
    Rectangle E3= new Rectangle(i,j,k,l);  
      g2.draw(E3);
      i-=1;
      j+=49;
      k+=39;
      l-=1;
 if(h==0)  {
  g2.setColor(Color.green);
 g2.fill(E3);}
 else if(h==1) {
     g2.setColor(Color.red);
 g2.fill(E3);}
  else if(h==2) {
     g2.setColor(Color.BLUE);
 g2.fill(E3); }
  else if(h==3) {
     g2.setColor(Color.ORANGE);
 g2.fill(E3); }
  else if(h==4) {
     g2.setColor(Color.pink);
 g2.fill(E3); }
  else if(h==5) {
     g2.setColor(Color.magenta);
 g2.fill(E3); }
  else if(h==7) {
     g2.setColor(Color.cyan);
 g2.fill(E3);

   }
 else if(h==8) {
     g2.setColor(Color.black);
 g2.fill(E3);

   }
 else if(h==9) {
     g2.setColor(Color.WHITE);
 g2.fill(E3);

   }
 else if(h==6) {
     g2.setColor(Color.RED);
 g2.fill(E3);

   }
else if(h==10) {
     g2.setColor(Color.YELLOW);
 g2.fill(E3);

   }
 else if(h==11) {
     g2.setColor(Color.darkGray);
 g2.fill(E3);

   }
 else if(h==12) {
     g2.setColor(Color.green);
 g2.fill(E3);

   }
 

   }
   
}}


Output is