/*
Strings.java - September 16, 2000 - Cory Goldfuss
A program that reads in a string entered by the user
and finds the number of characters in the string.
*/
import java.awt.*;
import java.applet.*;
import java.awt.event.*; //Event handling
public class Strings extends Applet implements ActionListener
{
public void init()
{
// Take out this line if you don't use symantec.itools.net.RelativeURL or symantec.itools.awt.util.StatusScroller
//symantec.itools.lang.Context.setApplet(this);
// This code is automatically generated by Visual Cafe when you add
// components to the visual environment. It instantiates and initializes
// the components. To modify the code, only use code syntax that matches
// what Visual Cafe can generate, or Visual Cafe may be unable to back
// parse your Java file into its visual environment.
//{{INIT_CONTROLS
setLayout(null);
setBackground(java.awt.Color.red);
setSize(548,127);
add(stringtxtFld);
stringtxtFld.setBackground(java.awt.Color.lightGray);
stringtxtFld.setBounds(120,24,420,24);
stringtxtLbl.setText("Type String Here --->");
add(stringtxtLbl);
stringtxtLbl.setBackground(java.awt.Color.pink);
stringtxtLbl.setFont(new Font("Dialog", Font.PLAIN, 10));
stringtxtLbl.setBounds(12,24,108,24);
add(replyLbl);
replyLbl.setBackground(java.awt.Color.lightGray);
replyLbl.setBounds(24,72,496,29);
//}}
stringtxtFld.addActionListener( this );
}
public void actionPerformed( ActionEvent e ){
if (e.getSource() == stringtxtFld) {
String userString = new String( stringtxtFld.getText() );
int stringLength = userString.length(); // Find length of users entered string
replyLbl.setText(userString + " (Length of string is:" + Integer.toString(stringLength)+ ")");
}// if
}//actionPerformed
//{{DECLARE_CONTROLS
java.awt.TextField stringtxtFld = new java.awt.TextField();
java.awt.Label stringtxtLbl = new java.awt.Label();
java.awt.Label replyLbl = new java.awt.Label();
//}}
}