2/23/11

Core java Programing for 5th Semester- passing parameter from HTML

//By Prasad.R...

import java.awt.*;
import java.applet.*;
public class HTML extends Applet
{
int a,b,c;
String d;
public void init()
{
a=Integer.parseInt(getParameter("A"));
b=Integer.parseInt(getParameter("B"));
c=a+b;
d=getParameter("name");
}
public void paint(Graphics g)
{
setBackground(Color.cyan);
g.drawString("A="+a,25,250);
g.drawString("B="+b,25,270);
g.drawString("SUM="+c,25,290);
g.drawString("name="+d,25,310);
}
}
//
////////

Core java Programing for 5th Semester- mousedemo.java

//By Prasad.R...

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class mousedemo extends Applet implements MouseListener,MouseMotionListener
{
String str=" ";
int x=0,y=0;
public void init()
{
addMouseListener(this);
addMouseMotionListener(this);
setBackground(Color.cyan);
}
public void mouseEntered(MouseEvent m)
{
showStatus("mouse entered.....");
x=m.getX();
y=m.getY();
str="mouse entered";
repaint();
}
public void mouseClicked(MouseEvent m)
{
showStatus("mouse clicked..");
x=m.getX();
y=m.getY();
str="mouse clicked";
repaint();
}
public void mouseExited(MouseEvent m)
{
showStatus("mouse exited....");
x=m.getX();
y=m.getY();
str="mouse exited";
repaint();
}
public void mousePressed(MouseEvent m)
{
showStatus("mouse pressed....");
x=m.getX();
y=m.getY();
str="mouse pressed";
repaint();
}
public void mouseReleased(MouseEvent m)
{
showStatus("mouse released....");
x=m.getX();
y=m.getY();
str="mouse released";
repaint();
}
public void mouseDragged(MouseEvent m){
showStatus("mouse dragged....");
x=m.getX();
y=m.getY();
str="mouse dragged";
repaint();
}
public void mouseMoved(MouseEvent m)
{
showStatus("mouse moved....");
x=m.getX();
y=m.getY();
str="mouse moved";
repaint();
}
public void paint(Graphics g)
{
g.drawString("testing........",10,10);
g.drawString(str,x,y);
}
}

/*
*/
By Prasad.R...

Factorial.java



class factorial
{
public static void main(String arg[])
{
int i,j,f,a,n;
n=arg.length;
for(i=0;i
{
f=1;
a=Integer.parseInt(arg[i]);
for(j=1;j<=a;j++)
{
f=f*j;
}
System.out.println("factorial of " +a +"\tis\t" +f);
}
}

}

Core java Programing for 5th Semester

By Prasad.R...

constructor Overloading


import java.io.*;
class overload
{
int a1,a2;
float f1,f2;
double d1,d2;
String s1,s2;
overload()
{
System.out.println("Constructor default values");
System.out.println("a1="+a1);
System.out.println("a2="+a2);
System.out.println("f1="+f1);
System.out.println("f2="+f2);
System.out.println("s1="+s1);
System.out.println("s1="+s2);
System.out.println("d1="+d1);
System.out.println("d2="+d2);
}
overload(int x1,int x2)
{
a1=x1;
a2=x2;
System.out.println("Constructor with 2 integer  values");
System.out.println("a1="+a1);
System.out.println("a2="+a2);
}

overload(float b1,float b2)
{
f1=b1;
f2=b2;
System.out.println("Constructor with 2 float values");
System.out.println("f1="+f1);
System.out.println("f2="+f2);
}

overload(double c1,double c2)
{
d1=c1;
d2=c2;
System.out.println("Constructor with 2 double   values");
System.out.println("d1="+d1);
System.out.println("d2="+d2);
}

overload(String st1,String st2)
{
s1=st1;
s2=st2;
System.out.println("Constructor with 2 String values");
System.out.println("s1="+s1);
System.out.println("s2="+s2);
}
}
class constructor
{
public static void main(String arg[]) throws Exception
{
int p1,p2;
float p3,p4;
double p5,p6;
String p7,p8;
DataInputStream dis=new DataInputStream(System.in);
{
overload n1=new overload();
System.out.println("enter 2 integer values");
p1=Integer.parseInt(dis.readLine());
p2=Integer.parseInt(dis.readLine());
overload n2=new overload(p1,p2);

System.out.println("enter 2 float values");
p3=Float.parseFloat(dis.readLine());
p4=Float.parseFloat(dis.readLine());
overload n3=new overload(p3,p4);

System.out.println("enter 2 double values");
p5=Double.parseDouble(dis.readLine());
p6=Double.parseDouble(dis.readLine());
overload n4=new overload(p5,p6);

System.out.println("enter 2 String  values");
p7=dis.readLine();
p8=dis.readLine();
overload n5=new overload(p7,p8);
}
}
}

4/11/10

send off  for seniors 
By Prasad.R...

visual basic programs for BCA 3 and BSC(C.S) and ENGG students.

animation control.


Dim flag As IntegerPrivate Sub Command1_Click()Animation1.Open "c:\search.avi"flag = 1End Sub
Private Sub Command2_Click()If flag = 1 ThenAnimation1.AutoPlay = TrueElseMsgBox "please press open button"End IfEnd Sub
Private Sub Command3_Click()
Animation1.CloseEnd Sub
Private Sub Command4_Click()
EndEnd Sub



simple example for ms excess DATABASE.

Private Sub Command1_Click()Data1.Recordset.MoveNextIf (Data1.Recordset.EOF) ThenMsgBox " end of file"Data1.Recordset.MoveFirst
End IfEnd Sub
Private Sub Command2_Click()Data1.Recordset.Delete
End Sub
Private Sub Command3_Click()Data1.Recordset.AddNew'Data1.Recordset.MovePrevious
End Sub


CHANGING FONT STYLE....

Private Sub Combo1_Click()Text1.FontSize = Combo1.TextEnd Sub
Private Sub Combo2_Click()Text1.FontName = Combo2.Text
End Sub
Private Sub Combo3_Click()If (Combo3.Text = "bold") ThenText1.FontBold = TrueText1.FontItalic = FalseText1.FontStrikethru = FalseText1.FontUnderline = FalseEnd If
If (Combo3.Text = "italic") ThenText1.FontBold = FalseText1.FontItalic = TrueText1.FontStrikethru = FalseText1.FontUnderline = FalseEnd If
If (Combo3.Text = "strikethru") ThenText1.FontBold = FalseText1.FontItalic = FalseText1.FontStrikethru = TrueText1.FontUnderline = FalseEnd IfIf (Combo3.Text = "underlined") ThenText1.FontBold = FalseText1.FontItalic = FalseText1.FontStrikethru = FalseText1.FontUnderline = TrueEnd IfEnd Sub
Private Sub Form_Load()Combo1.AddItem "8"Combo1.AddItem "16"Combo1.AddItem "20"Combo1.AddItem "26"Combo2.AddItem "ms sans serif"Combo2.AddItem "arial"Combo2.AddItem "modern"Combo2.AddItem "impact"Combo3.AddItem "bold"Combo3.AddItem "italic"Combo3.AddItem "strikethru"Combo3.AddItem "underlined"


NUMBER TO TEXT PROGRAM....

Private Sub Command1_Click()Dim x As IntegerDim t As IntegerDim h As IntegerDim tn As IntegerDim w(19) As StringDim m(10) As StringDim s As Stringx = Val(Text1.Text)'ch = n - tn * 10w(1) = "one"w(2) = "two"w(3) = "three"w(4) = "four"w(5) = "five"w(6) = "six"w(7) = "seven"w(8) = "eight"w(9) = "nine"w(10) = "ten"w(11) = "eleven"w(12) = "twelve"w(13) = "thirteen"w(14) = "forteen"w(15) = "fifteen"w(16) = "sixteen"w(17) = "seventeen"w(18) = "eighteen"w(19) = "ninteen"m(1) = "ten"m(2) = "twenty"m(3) = "thirty"m(4) = "forty"m(5) = "fifty"m(6) = "sixty"m(7) = "seventy"m(8) = "eighty"m(9) = "ninety"t = Int(x / 1000)x = x - (t * 1000)h = Int(x / 100)x = x - (h * 100)tn = Int(x / 10)x = x - (tn * 10)If (t >= 1) And (t <= 19) Thens = s + w(t) + "thousand"End IfIf (t >= 20) Thens = s + m(t) + "thounsand"End IfIf (h >= 1) Thens = s + w(h) + "hundred"End IfIf (tn > 1) Thens = s + m(tn)ElseIf (tn = 1) Thens = s + w(x + 10)GoTo display
End IfIf (x >= 1) Thens = s + w(x) + "only"End Ifdisplay:Text2.Text = sEnd Sub
Private Sub Form_Load()Text1.Text = ""Text2.Text = ""
End Sub

how to make a simple coollll vb game


>>>>>just copy paste the below code>>>>



Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)Command1.Top = Int(Rnd * 10000)Command1.Left = Int(Rnd * 10000)Command1.Width = Int(Rnd * 2500)Command1.Height = Int(Rnd * 5700)Command1.BackColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)End Sub
Private Sub Form_DblClick()MsgBox "YOU WON GAME OVER"EndEnd Sub
Private Sub Form_Load()Option1.Value = TrueMe.WindowState = 2End SubPrivate Sub Label3_Click()EndEnd SubPrivate Sub Option1_Click()

On Error Resume NextResult = Module1.sndPlaySound("C:\WINDOWS\INSTALL.WAV", 1)
End Sub
Private Sub Option2_Click()On Error Resume NextResult = Module1.sndPlaySound("C:\WINDOWS\", 1)End Sub

how to make transparent form in vb6??

Private Declare Function SetWindowLong Lib "USER32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "USER32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Sub Form_Load() SetWindowLong Me.hWnd, (-20), &H80111 SetLayeredWindowAttributes Me.hWnd, 0, 200, &H2End Sub