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. An applet program to draw concentric circle in center of the canvas

  2. Program to show the use of Labeled Break Statement

  3. Program in CORBA which takes a long sentence from client (at least 7 words), passes to the server, server separates out each word and sends back

  4. Program of reading and writing primitive data

  5. Application which takes your marks of six subjects from the client side and displays the percentage that you have obtained

  6. Program to declare, initialize and print a String object

  7. Program to show an example of getting at characters in a String

  8. Program to evaluate following investment equation V=P(1+R)^N

  9. Program to reverse the number eg given no : - 12345, output want :- 54321

  10. Program to display following things on the client machine a)date and time of the server machine b)date and time of the client machine and difference

  11. Program of writing Bytes to a File

  12. An applet program to draw circle in center of the canvas

  13. Program to Display Output in triangular shape

  14. Program of concatenating and Buffering files

  15. Program that accepts a shopping list of five items from the command line and stores them in vector

  16. RMI based application, which reads a file with list of marks of student from a client, send it to server and find how many students having distinct

  17. Program to copy the elements of an array into another array in reverse order and print them

  18. Program that enabled applet that takes name of the user. Server returns back the number in uppercase clubbed with “HELLO” and display it on applet

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

  20. Program to make directory

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