Skip to main content

Posts

this blog

this is a net web blog journal diary that is formed and made  by a Indian student for faculty,college kids,children and youngsters as a gift for you to hold and carry everywhere and everyplace around  the globe.This journal is completely and totally free from price to use and is extremely easy to use and very easy to understand.

Speedometer in applet

import java.applet.*; import java.awt.*; import java.lang.*; import java.math.*; import java.awt.Color; /*<applet code="speed" height=678 width=678></applet>   */ public class speed extends Applet implements Runnable { int i=0,j=180,p=1; double x,y; String un=""; Thread t; public void init() { t=new Thread(this); t.start(); } public void run() { try { while(true) { repaint(); t.sleep(100); } }catch(Exception e) { System.out.println(e); } } public void update(Graphics g) { paint(g); } public void paint(Graphics g) { g.setColor(Color.yellow); g.fillOval(100,100,536,536); g.setColor(Color.blue); g.fillOval(138,138,460,460); g.setColor(Color.yellow); x=368+ 230*Math.cos(Math.toRadians(j)); y=368+ 230*Math.sin(Math.toRadians(j)); g.drawLine((int)x,(int)y,368,368); g.setColor(Color.black); for(int pr=0;pr<=270;pr++) { if(pr%10==0) { un=""; un=un+pr; g.drawString(un,(int)(368+ 230*M...

Animated Face in java

import java.applet.*; import java.awt.*; import java.lang.*; import java.math.*; import java.awt.Color; /*<applet code="face" height=578 width=678></applet>   */ public class face extends Applet implements Runnable { int i=0,j=0,p=1; Thread t; public void init() { t=new Thread(this); t.start(); } public void run() { int sec=0; try { while(true) { repaint(); sec+=1; t.sleep(100); } }catch(Exception e) { System.out.println(e); } } public void update(Graphics g) { paint(g); } public void paint(Graphics g) { Dimension d=this.getSize(); double x=Math.random()*d.width; double y=Math.random()*d.height; setBackground(Color.black); g.setColor(Color.yellow); g.fillOval(118,118,500,400); g.setColor(Color.white); g.fillOval(219,158,90,90); g.fillOval(419,158,90,90); g.fillOval(319,258,80,150); g.setColor(Color.red); g.fillArc(219,418,300,50,180,180); g.setColor(Color.black); g.fillOval(219+j*p,188,30,30); g.fi...

Animated Rainbow in Applet

import java.applet.*; import java.awt.*; import java.lang.*; import java.math.*; import java.awt.Color; /*<applet code="rainbow" height=1200 width=1200></applet>   */ public class rainbow extends Applet implements Runnable { int i=0,j=0; int rr[]={148,75,0,0,255,255,255}; int gg[]={0,0,0,255,255,127,0}; int bb[]={211,130,255,0,0,0,0}; Thread t; public void init() { t=new Thread(this); t.start(); } public void run() { int sec=0; setSize(1200,1200); try { while(true) { repaint(); sec+=1; t.sleep(1000); } }catch(Exception e) { System.out.println(e); } } public void update(Graphics g) { paint(g); } public void paint(Graphics g) { setBackground(Color.black); for(i=0;i<7;i++) { Color r=new Color((int)rr[i],(int)gg[i],(int)bb[i]); g.setColor(r); g.fillArc(8+30*i,8+30*i,1000-60*i,1000-60*i,0,j); } g.setColor(Color.black); g.fillArc(218,218,580,580,0,180); if(j==180) t.stop(); j+=10; } }

Merging two string array with the use of threads

import java.io.*; import java.lang.*; class M3 extends Thread { String c[]=new String[10],t; int i,j; M3(M1 a,M2 b)      { for(i=0;i<a.a.length;i++) c[i]=a.a[i]; for(i=0;i<b.a.length;i++) c[5+i]=b.a[i];     } public void run()    { for(i=0;i<9;i++) { for(j=0;j<8;j++) { if(c[j].compareTo(c[j+1])>0) { t=c[j]; c[j]=c[j+1]; c[j+1]=t; }}} System.out.println("\nThe full list"); for(i=0;i<10;i++)  System.out.println(c[i]);     } } class M1 extends Thread { int i; String a[]=new String[5]; public void run() { try { DataInputStream dd= new DataInputStream(System.in); System.out.println("Enter  for thread1"); for(i=0;i<5;i++) for(i=0;i<5;i++) { a[i]=dd.readLine(); } } catch(Exception e) {} } } class M2 extends Thread { int i; String a[]=new String[5]; public void run() { try { DataInputStream dd= new DataInputStream(System.in); System.out.println("...