Java Tutorial

 
 
 
 
/* <applet code=\"sumOf2No\" height=150 width =350>
   </applet> */

import java.awt.*;
import java.applet.*;

public class sumOf2No extends Applet
{
     TextField T1,T2;

     public void init() {
         T1 = new TextField(10);
         T2 = new TextField(10);
         add(T1);
         add(T2);
         T1.setText(\"0\");
         T2.setText(\"0\");
      }

      public void paint(Graphics g) {
           int a, b, result;
           String str;

           g.drawString(\"Enter Number in TextField to Find addition of 2 No \",10,50);
           g.setColor(Color.red);
           str=T1.getText();
           a=Integer.parseInt(str);
           str=T2.getText();
           b=Integer.parseInt(str);
           result=a+b;
           g.drawString(\"After Addition the Result is : \"+result,10,80);
           showStatus(\"Addition of 2 Numbers\");
        }

        public boolean action(Event e, Object o){
            repaint();
            return true;
        }
}

    Related Post:
  1. CORBA program for displaying the date and time of the server machine, client machine and the difference between these two date and time

  2. Program to find the number of and sum of all integers greater than 100 and less than 200 that are divisible by 7

  3. Create an interface coversions. Which have the following functions Inchestomillimeters(), hptowatts(),wattstohp(),poundstogram(),gramtopounds()

  4. File handling program to count number of characters in a file

  5. Even number ,Prime no. ,Factorial of a number

  6. Program of date server and client

  7. Program to show the use of Logical or Boolean Negation i.e. NOT (!)

  8. Corba program to develop a simple calculator with addition, subtraction, multiplication and division capabilities, data collection from client side

  9. Program to show the use of Bitwise Operator (~) Complement

  10. Encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time after each word in the sent

  11. Program to show an example of Concatination of Strings

  12. Develop a simple calculator with addition, subtraction, multiplication and division capabilities, data collection from client side, executed on server

  13. An applet program to perform quick sort

  14. Socket program of HTTP Server

  15. An applet program that creates string dynamically and displays it

  16. RMI application for counting factorial of a given number.

  17. Program to declare, initialize and print an array of integers

  18. Program which calls the method sort(int []a) which throws the Exception ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException

  19. Program for calculating area of a circle on server side,when a client sends request along with given radius and then displaying result on client side

  20. Program to show an example of overloading constructors in a class to initialize its data members

 
 
Didn't find what you were looking for? Find more on An applet program to display sum of two number of textField