Glossary of Terms


A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #

Select the first letter of the word from the list above to jump to appropriate section of the glossary. If the term you are looking for starts with a digit or symbol, choose the '#' link.


- A -

Action Event
An action event is the event created by activating a simple component. The action event for a button is triggered by clicking on the button. The action event for a text field is triggered by pressing the "enter" key when the cursor is in the text field. Although the label inherits an action method from the Component class, it is never called. In the case of action events, the default handleEvent method invokes a method called action. You can override the action method to take any action you wish. To provide an action event handler for a component you can inherit from the component and override the action method. So if your applet had a button, you could create a new class NewButton and the NewButton.action method would receive the action event generated by clicking on NewButton. There is a better way to handle this than creating a separate class for each component in the applet. The default action method for each component simply invokes the action method of its parent. In the case of a component this would be the applet since it is the container containing the button. To identify which component generated the action, the Event object passed to action contains two arguments. target is a reference to the object (for example, a Component) that initiated the action and Event.arg describes the new state of the target object. arg can be a string containing text or the position to scroll to, depending on the type of component being considered.
 
Hit the "Return to previous page" or "back" button on your browser
 
Applet
Applets are small applications written in Java that run inside Web pages. A reference to an applet is embedded in a Web page using a special HTML tag. When a reader, with a Java capable browser, loads a Web page with an applet in it, the browser downloads that applet from a Web server and executes it on their local system. The Java applet utilizes the structure provided by the browser such as an existing window, an event-handling and graphics context, and the surrounding user interface. They are restricted, however, for security reasons to prevent an applet from causing system damage.
 
Arithmetic Operators
+ addition
- subtraction
* multiplication
/ division
% modulus
x += y x = x + y
x -= y x = x - y
x *= y x = x * y
x /= y x = x / y
x++ x = x + 1
++x pre-increment x
(x+1)

Hit the "Return to previous page" or "back" button on your browser

Back to Top

- B -

(empty)
Back to Top

- C -

Class
Classes are used in object-oriented programming. A class is a template from which objects are created. An object is an instance of a class. Classes can be composed of a mixed assortment of types and other classes and can inherit properties from parent classes. They can have operations called Methods as part of their definition. It is the definition of these classes that is the job of the programmer.

 

Command Line Parameters

Command line parameters are given when the program is run.
For example if a java program named addem is run with the following line

java addem 34 22 87 9

The program addem will start and the numbers 34, 22, 87 and 9 will be available to the program as command line parameters. If we write the necessary code , the parameters are parsed (looked at one at a time) from left to right and made available for use within the program.

We could make the helloworld applet a bit more friendly using parameters. If we rewrite the applet to accept a parameter and call the applet from within our HTML code with a name for that parameter it could be changed from simply printing "Hello World" to printing "Hello Joe" or any name we want. (Click here to see the code)

These parameters can be used in both Java applications and applets. They allow us to adapt programs to the current situation.

Hit the "Return to previous page" or "back" button on your browser

Compiling and Running a Java Application

Usually it is easier to use Notepad or Wordpad in Windows to copy the source code. While the browser is displaying the source code, highlight the code and then click edit and copy (or hit Ctrl-c on the keyboard). Switch to your editor and paste the code into your document.

If you insist you can still do it the hard way and type the lines in yourself.

Once you have entered the code:

  1. Save the source code under the name suggested in the lesson with the .java extension.

  2. Exit the text editor and return to a command prompt.

  3. Type "javac ******.java" at the command prompt.

    If there are any errors, return to the editor and ensure the source code is exactly the same as what you see in the lesson. Remember that
    Java is case sensitive. Check your upper case letters carefully.
    If there are no errors the compiler will work for a few seconds and then save a file called ******.class in the same directory.

  4. To run the .class file type "java ******" at the command prompt.
    (where ****** is the name of the .class file.)
    DO NOT type java ******.class. It will not execute if you do.

Hit the "Return to previous page" or "back" button on your browser

Conditions

Java Comparison Operators Java Logical Operators
= = equals
< Less than
> Greater than
!= not equal to
<= less than or equal to
>= greater than or equal to
& and
&& and
| or
|| or
^ exclusive or
! not

Hit the "Return to previous page" or "back" button on your browser

Create an HTML Page (for your Applet)

Once your applet has been compiled, it must run in a graphic window that is large enough to accommodate the pixels in the applet. The following HTML code will serve as a template to run an applet in your browser.

  1. The defined applet window must be large enough to hold the applet or it will be cropped.

  2. The name of the file called within the HTML code must match the name of the class file exactly, including the case of the letters.

  3. The compiled class file must be in the same directory as the HTML code that is calling it (or the precise path must be specified in the HTML code.)

<html>
<head>

<title>Applet Page</title>
</head>

<body>

<p align="left"><font size="6">
<strong>View of the applet's
output</strong></font></p>

<p><applet code="Hello.class"
align="baseline" width="301"
height="301"></applet></p>


</body>

</html>



.



<This line places a label above the applet

.

< The Applet is inserted here with an
appropriate window size of height and width
in pixels.
<Check that you are calling the correct
class file and that it has been saved
in the same directory.

This generic HTML page can be used to display all of your applets (adjust the size of the pixel window so that your applet is not cropped).

Hit the "Return to previous page" or "back" button on your browser

Back to Top

- D -

(empty)
Back to Top

- E -

Elements

An Overview of HTML Elements: HTML tags are used to mark the elements of a file for your browser. The left and right angle brackets denote tag names. For example <head> marks the heading and </head> marks the end of the heading. There are two types of HTML tags:

HTML Elements for Head Sections in HTML Documents

Element Element Type Description
BASE empty Base context document
HEAD container Document head
ISINDEX empty Document is a searchable index
LINK empty Link from this document
META container Generic meta-information
NEXTID empty Next ID to use for link name
TITLE container Title of document

HTML Elements for Body Sections in HTML Documents

Element Element Type Description
A container Anchor:source and/or destination of a link
ADDRESS container Address, signature, or byline for a document
B container Bold text
BLOCKQUOTE container Quoted passage
BODY container Document body
BR empty Line break
CITE container Name or title of cited work
CODE container Source code phrase
DD empty Definition of term
DIR container Directory list
DL container Definition list, or glossary
DT empty Term in definition list
EM container Emphasized phrase
H1 container Heading, level 1
H2 container Heading, level 2
H3 container Heading, level 3
H4 container Heading, level 4
H5 container Heading, level 5
H6 container Heading, level 6
HR empty Horizontal rule
I container Italic text
IMG empty Image; icon, glyph, or illustration
KBD container Keyboard phrase, such as user input
LI empty List Item
LISTING container Computer listing
MENU container Menu list
OL container Ordered or numbered list
P empty Paragraph
PRE container Preformatted text
SAMP container Sample text or characters
SELECT empty Selection of option(s)
STRONG container Strong emphasis
TT container Typewriter text
UL container Unordered list
VAR container Variable phrase or substitutable
XMP container Example Sections

Click on the "Return to previous page" or "back" button on your browser

Back to Top

- F -

Frames
The java.awt.Frame class encapsulates a Frame. A Frame is a top-level window with a title. A Frame is a window and it can also be a parent for other windows. In a standalone Java program you must create, resize, and show a Frame before you can display a Window. Applets are contained within a panel of the browser so they do not require a Frame. In an applet, the browser's top-level window is the Frame.
Back to Top

- G -

(empty)
Back to Top

- H -

Handle Event
The handleEvent method is inherited by all applets from the Applet class which itself is a subset of the Component class. This method is called whenever an event occurs that needs processing. The Event object passed to handleEvent describes the nature of the event that occurred. Properties of this object include: (1) id - a number that identifies the nature of the event. (2) target - the object upon which the event occurred. (3) when - the time that the event occurred. (4) modifiers - the modifier state. (5) x,y - the x and y coordinates of the mouse pointer in the case of mouse events. (6) clickCount - the number of times in a row that the mouse was clicked for the mouseDown event. (7) key - the key that was pressed or released for keyDown and keyUp events. (8) arg - a second object for certain type events such as a scrollbar.

Hit the "Return to previous page" or "back" button on your browser

Back to Top

- I -

Inheritance
Inheritance refers to the fact that an object in Java can receive or inherit the properties of its parent object. Since Java is organized as a hierarchy of classes and subclasses, an object can inherit properties and methods from its parent or its super class. A subclass can override a method in the super class if desired. To override a method is to replace an inherited method with a method specific to the subclass.
Back to Top

- J -

(empty)
Back to Top

- K -

(empty)
Back to Top

- L -

(empty)
Back to Top

- M -

(empty)
Back to Top

- N -

(empty)
Back to Top

- O -

(empty)
Back to Top

- P -

Panels
A panel in Java's AWT is a generic container for graphical elements. It is not a window in itself but its purpose is to help organize components in a window. An applet is a subclass of the panel class.
Pixels
Pixels is short for picture element and each one is a dot on the screen. Each pixel can have its own color value and the receiving computer displays it according to its own capabilities. A window is an array of pixels. If you create an applet and there are not enough pixels in the window to hold your applet, the output will be clipped. In other words, you will only be able to view the part of the applet that fits in the viewing window defined.

Hit the "Return to previous page" or "back" button on your browser

Back to Top

- Q -

(empty)
Back to Top

- R -

(empty)
Back to Top

- S -

(empty)
Back to Top

- T -

(empty)
Back to Top

- U -

(empty)
Back to Top

- V -

Variables
Java Variable Types
Type Size Range
byte 8 bits -128 to 127
short 16 bits -32,768 to 32,767
int 32 bits -2,147,483,648 to 2,147,483,647
long 64 bits -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
float 32 bits IEEE 754 Standard floating point number
double 64 bits Double Precision IEEE 754 Standard floating point number
char 16 bits Unicode Character set
boolean 1 bit true or false

Hit the "Return to previous page" or "back" button on your browser

Back to Top

- W -

(empty)
Back to Top

- X -

(empty)
Back to Top

- Y -

(empty)
Back to Top

- Z -

(empty)
Back to Top

- # -

(empty)
Back to Top

Revised: September 22, 1997.
Copyright © 1995 by [SomeOrganization].
All trademarks or product names mentioned herein are the property of their respective owners.

Back to the Table of Contents