Java Tutorial

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

public class UserInput extends Applet
      TextField text1, text2;

      public void init()
           text1 = new TextField(8);
           text2 = new TextField(8);

      public void paint(Graphics g)
          int x=0,y=0,z=0;
          String s1,s2,s;
          g.drawString(\"Input a number in each box  \",10,50);
                 s1 = text1.getText();
                 x = Integer.parseInt(s1);
                 s2 = text2.getText();
                 y = Integer.parseInt(s2);
          catch(Exception e) {}

           z = x + y;
           s =  String.valueOf(z);
           g.drawString(\"The Sum is : \",10,75);

    public boolean action(Event event, Object obj)
          return true;

    Related Post:
  1. Corba program of Count Client Applet, IDL,Server, Client

  2. Program to read rollno, marks of sub1,sub2 and sub3 and on basis of that display result

  3. Program to show an example of creating a class and using its object

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

  5. Program to show the use of operator (<<) Shift Left filling with zero from the right

  6. Program to declare and initialize Boolean variables and print them on the Standard Output Device

  7. Program of UDP news server

  8. Corba program to encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time.

  9. An applet program to draw Polygon Graph with given data

  10. An applet program to display sum of two number of textField

  11. Corba program of game

  12. Program of Floyds Triangle

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

  14. 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

  15. CORBA program for displaying the date and time of the server machine, client machine and the difference between these two date and time

  16. Program to calculate the frequency for different values of C starting from 0.01 to 0.1 in steps of 0.01

  17. Program to display Floyds Triangle of a numbers

  18. Program to show the use of Break Statement


  20. Program to show the use of Conditional AND Operator (&&) in If Statements

Didn't find what you were looking for? Find more on An applet program to take user input and display