Question: exam



Share on Google+Share on Google+

hashihi raja
1 Answer(s)      6 years and 2 months ago
Posted in : HTML

Write a Java applet that that takes in a sentence from the user through a text field and append the sentence to a text area in individual line when the button labeled APPEND is clicked. When the sentence is appended to the text area, the program will also count the number of the word "the" or "The" that appeared and display the total count in another text field. Provide another button labeled CLEAR to clear the sentence input text field. The panel that contains all the GUI components should be separated in a class, while the applet that invokes this panel should be in another class.

View Answers

March 7, 2011 at 5:40 PM

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class Example
    JFrame f=new JFrame();
    JLabel label1=new JLabel("String: ");
    JLabel label2=new JLabel("Append: ");
    JLabel label3=new JLabel("Count Words: ");
    final JTextField text1=new JTextField(20);
    final JTextArea area=new JTextArea(5,20);
    final JTextField text2=new JTextField(20);
    JButton b=new JButton("Append");
    JButton b1=new JButton("Clear");
    b.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
            String str=text1.getText();
        int count=0;
        String arr[]=str.split(" ");
        for(int i=0;i<arr.length;i++){
    b1.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){




    class StringExample8{
    public static void main(String[] args) {
        new Example();


Related Tutorials/Questions & Answers:
Online Exam
Online Exam  I want to write a program for Exam with multiple answers program can read answers one by one and it shows the total marks at the end how it can implement Help me
Exam help
Exam help  A table exists which has a primary key field which is numeric, and is called Id. When inserting a new record into this table you should ensure that the Id used is the next available Id. Discuss how you would
SCJA Syllabus And Exam Fees
SCJA Syllabus And Exam Fees  What is SCJA syllabus and exam fees for SCJA and also exam dates in 2012 for SCJA? Thanking You (In Advance
Exam Dates Of SCJP 2011
Exam Dates Of SCJP 2011  List all the exam dates of scjp that will be held in 2011
SCJP exam date 2011
SCJP exam date 2011  Please provide me the list of exam dates that will be in the yr. 2011 for SCJP.... Thank You In Adv
online exam portal
online exam portal  i am thinking of developing a small online exam pattern with multipe choice questions , can u please give me any idea of how to start
jsp online exam...
jsp online exam...  Plz provide me front end design
ONLINE EXAM CODE SPLIT  hi.. im developing online exam for c programming in jsp.. i read the question from database as a string suppose String ques="#include<stdio.h>main(){int i;for(i=0;<100;i++){printf("hai
Part I. Exam Objectives
Part I. Exam ObjectivesPrev   Next    Exam Objectives Learn how to develop and deploy enterprise application
Part I. Exam Objectives
Part I. Exam ObjectivesPrev   Next    Exam ObjectivesVisit  for the updates.    Prev Up NextPreface Home 
how to create online exam in jsp and database
how to create online exam in jsp and database  learing stage ,want to know how to create online exam
Online exam using c# and SQL server
Online exam using c# and SQL server  hello, i'm making the (window... then client must get the relevant message and exam on client must gets stopped, until server didn't start the same exam. so to do that what should I do? plz help
Should we go for javascript or applets for online exam project using java
Should we go for javascript or applets for online exam project using java  Hi, I am new to java and i am working on online examination project.As soon as the candidate login successfully a window pop up should appear
Code to STOP Students from navigating anywhere else till the Online exam is over
Code to STOP Students from navigating anywhere else till the Online exam is over  hi guys i am a final year student of engineering and i am working.... now i am come across one problem, i want that during the exam the student
Sun Certified Java Professional (SCJP)
& drop in both version. Exam Objectives
JAX-RPC Advance Concepts
in the exam table.It should use SOAP Request and SOAP Response. Solution... for student Create a exam operation in the web service Add... = "exam")   public String exam(@WebParam(name = "roll"
Java Certification Books
Sun Microsystems-the creator of Java-offers a Certification Exam that programmers... for taking the test -since the author of the book actually developed the exam... the questions! This Study Guide covers every exam objective defined by Sun--including
Chapter 2. Design, build and test web components
Chapter 2. Design, build and test web componentsPrev Part I. Exam Objectives Next    Chapter 2. Design, build and test web components
Java Spring Hibernate Struts Training How to display button as a link in vaadin? hi change navbar dropdown color in bootstrap How to remove the background color of bootstrap menu bar? How to change color of opened Bootstrap drop down toggle? Setting bootstrap container background color Help school all activities and admision process.. add one row after another date make a webpage HTMl HTMl Source code how to apply globalisation to a world wide application how to print HTML using javascript or Jquery How to recover from google panda update? How to survive google panda 4.0 update How to find if you have been hit by Panda 4.0 Design a web page using XHTML and JavaScript that does the followings: ffmpeg converting file mp4 to mov JavaScript How to Disable Catch-all Emails on CPanel z-index always on top What is Web hosting Database and HTML web development trainee Uploading files Image Gallery Image Gallery dropdown How to redirect from a HTML page? Easiest method for expiring the css and js headers HTML WITH AJAX VB 6 Read Web Page Header string palindrom using vbscript? html button How to add mod_deflate to apache without recompiling How to use place hoder in IE(version : 8) Html Software Question div align left css Fetching data from excel file on other website and display in interactive graph form where do I find the fix for tree view catalog not expanding and collapsing correctly for roseindia shopping cart 1.1 pass to next page to enter into a particular page only if the username,password and listbox value mtches hi Cricket stadium ticket booking design Need some help creating an order form. HTML div tag HTML div tag


Advertisement null