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. Develop a game application in CORBA for which the player will guess a number between 1 to 100, which will be compared to the random number generated b

  2. Corba program of Count Client Applet, IDL,Server, Client

  3. Program which simulate the dictionary in java

  4. Program which creates an Array of character. Make one function with one argument as a character and that function throw a user defined exception

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

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

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

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

  9. Program of date server and client

  10. An applet program to display alternate filled and empty circle that to in row and column format

  11. Program to show the use of While Loop

  12. Program to show the use of Conditional (Ternary) Operator

  13. Program to show the use of Break Statement

  14. Program to show an example of Multiple Levels of Inheritance

  15. Program which will read a string and rewrite it in the alphabetical order

  16. Write a program for restaurant

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

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

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

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

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