Java Program for calculator

Thursday, December 3rd, 2009  »  Posted By  »  Total 2 Comments

JPanel p = new JPanel();
p.setLayout(new GridLayout(4, 4));
String buttons = “789/456*123-0.=+”;
for (int i = 0; i < buttons.length(); i++)
addButton(p, buttons.substring(i, i + 1));
add(p, “Center”);

Java program of Client-Server network for Chatting between Client and Server

Sunday, October 4th, 2009  »  Posted By  »  Total 2 Comments

BufferedReader cin=newBufferedReader(newInputStreamReader(sk.getInputStream()));
PrintStream cout=new PrintStream(sk.getOutputStream());
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));

Java program that finds the area of a circle using Client-Server network

Sunday, October 4th, 2009  »  Posted By  »  Total 1 Comment

ServerSocket ss=new ServerSocket(2000);
Socket s=ss.accept();
BufferedReader br=new BufferedReader(newInputStreamReader(s.getInputStream()));
double rad,area;
String result;

Java program that illustrates how run time polymorphism is achieved

Sunday, October 4th, 2009  »  Posted By  »  Total 0 Comment

figure f=new figure(45,6);
rectangle r=new rectangle(10,30);
triangle t=new triangle(10,20);
figure a;
a=f;
System.out.println(a.area());

Java applet program that allows the user to draw lines, rectangles and ovals

Java applet progrme for draw lines, circle, rectangle Sunday, October 4th, 2009  »  Posted By  »  Total 6 Comments

Color c1=new Color(35-i,55-i,110-i);
g.setColor(c1);
g.drawRect(250+i,250+i,100+i,100+i);
g.drawOval(100+i,100+i,50+i,50+i);
g.drawLine(50+i,20+i,10+i,10+i);

Java applet program for handling Keyboard events

Java Keyboard programe output Sunday, October 4th, 2009  »  Posted By  »  Total 6 Comments

public void init()
{
addKeyListener(this);
requestFocus();
setBackground(Color.green);
setForeground(Color.blue);
}

Java program for implentation of consumer problem using inter thread communication

Sunday, October 4th, 2009  »  Posted By  »  Total 2 Comments

Write a Java program that correctly implements producer consumer problem using the concept of inter thread communication

Java applet program for handling mouse events

Java mouse handling events Sunday, October 4th, 2009  »  Posted By  »  Total 6 Comments

addMouseListener(this);
addMouseMotionListener(this);
setBackground(Color.black);
setForeground(Color.red);

Java program for creating multiple threads

Sunday, October 4th, 2009  »  Posted By  »  Total 1 Comment

NewThread(String threadname)
{
name=threadname;
t=new Thread(this,name);
System.out.println(“New Thread:”+t);
t.start();
}

Java applet program for calculator

Sunday, October 4th, 2009  »  Posted By  »  Total 13 Comments

Write a Java program that works as a simple calculator. Use a grid layout to arrange buttons for the digits and for the + – * % operations.Add a text field to display the result.

Question and Answer
C/C++ Unix & Linux Wordpress
Source codes
C C++ Java

Free email signup