import java.awt.*;
import javax.swing.*;
class SearchJavaGlossary
{
private static String[][] javaGlossarySearch = {
{"absolute path","a complete file path that does not require any other information to locate a file on a system."},
{"abstract class","a class from which you cannot create any concrete objects, but from which you can inherit. Abstract classes usually have one or more empty abstract methods. Contrast with concrete classes."},
{"abstract data type","a type whose implementation is hidden and accessed through its public methods."},
{"abstract method","a method declared with the keyword abstract; it is a method with no body that must be implemented in a subclass."},
{"Abstraction","the programming feature that allows you to use a method name to encapsulate a series of statements."},
{"Accelerator","a key combination that causes a menu item to be chosen, whether or not the menu item is visible."},
{"access modifier","an access specifier."},
{"access specifier","defines the circumstances under which a class can be accessed and the other classes that have the right to use a class."},
{"accessor methods","methods that return information about an object."},
{"Accumulating","the process of repeatedly increasing a value by some amount to produce a total."},
{"action key","a keyboard key that does not generate a character."},
{"actionPerformed(ActionEvent e) method","a method that defines the actions that occur in response to an event."},
{"actual parameters","the arguments in a method call. Contrast with formal parameters."},
{"acyclic gradient","a fill pattern in which a color shift occurs once between two points."},
{"adapter class","a class that implements all the methods in an interface, providing an empty body for each method."},
{"add and assign operator","an operator that alters the value of the operand on the left by adding the operand on the right to it; it is composed of a plus sign and an equal sign ( += )."},
{"add() method", "a method that adds components to a container."},
{"addActionListener() method","a method that tells a class to expect ActionEvents."},
{"addPoint() method","a method that adds points to a Polygon object."},
{"ad-hoc polymorphism","polymorphism that occurs when a single method name can be used with a variety of data types because various implementations exist; it is another name for method overloading."},
{"aggregation","a type of composition in which a class contains one or more members of another class that would continue to exist without the object that contains them."},
{"Allman style","the indent style in which curly braces are aligned and each occupies its own line; it is named for Eric Allman, a programmer who popularized the style. Contrast with K & R style."},
{"ambiguous","describes a situation in which the compiler cannot determine which method to use."},
{"anonymous classes","nested, local classes that have no identifier."},
{"anonymous object","an unnamed object."},
{"append() method","a StringBuilder class method that lets you add characters to the end of a StringBuilder object."},
{"applet","a Java program that is called from within another application, frequently a Web page."},
{"Applet Viewer","a program that comes with the JDK that allows you to view applets without using a Web browser."},
{"appletviewer command","a command that allows you to view an applet in a viewing program that comes with the JDK."},
{"application","a stand-alone, executable program."},
{"application files","files that store software instructions. See also program files."},
{"application-triggered painting","painting operations that occur when the internal state of a component has changed.Contrast with system-triggered painting."},
{"arc", "a portion of a circle."},
{"architecturally neutral","describes the feature of Java that allows a program to run on any platform."},
{"argument index","in a printf() statement, an integer that indicates the position of an argument in the argument list."},
{"arguments","data items sent to methods in a method call."},
{"arithmetic operators","operators used to perform calculations with values."},
{"array","a named list of data items that all have the same type."},
{"ArrayList class","a Java class that provides a dynamically resizable container that stores lists of objects."},
{"Arrays class","a built-in Java class that contains many useful methods for manipulating arrays, such as methods to search, fill, compare, and sort arrays."},
{"ascending","describes the order from lowest value to highest."},
{"ascent","one of three measures of a Font’s height; it is the height of an uppercase character from a baseline to the top of the character. See also leading and descent."},
{"ASCII","an acronym for American Standard Code for Information Interchange, a character set widely used to represent computer data."},
{"assert statement","a statement that creates an assertion."},
{"assertion","a Java language feature that can help you detect logic errors and debug a program."},
{"assignment","the act of providing a value for a variable."},
{"assignment operator","the equal sign ( = ); any value to the right of the equal sign is assigned to the variable on the left of the equal sign."},
{"associativity","describes the order in which operands are used with operators."},
{"at run time","describes the period of time during which a program executes."},
{"attributes","the characteristics that define an object as part of a class."} };
public static void main(String[] args)
{
searchGloss();
} //end main()
public static void searchGloss()
{
//declarations
boolean wordWasFound = false;
boolean validEntry = false;
String message = "";
while(validEntry == false)
{
String searchWord = JOptionPane.showInputDialog(
null,
"Enter the word you"
+ " would like to search in the Java reserved "
+ "keyword list","Java Keyword search",
JOptionPane.PLAIN_MESSAGE);
if(searchWord == null) return; //sends user back to option screen
else if(searchWord.equals(""))
{
JOptionPane.showMessageDialog(
null,
"Please type a word before pressing the enter key or "
+ "clicking OK.",
"Search results",
JOptionPane.ERROR_MESSAGE);
}
else
{
validEntry = true;
for(int x = 0, y = javaGlossarySearch.length; x < y; x++)
{
for(int xx = 0, yy = javaGlossarySearch[x].length; xx < yy; xx++)
{
if(searchWord.equals(javaGlossarySearch[x][xx]))
{
wordWasFound = true;
break;
}
}
if(wordWasFound) break;
}
if(wordWasFound)
{
message = ": " // change this for the definition
}
else
{
message = " was not found!";
}
JOptionPane.showMessageDialog(
null,
"'" + searchWord + "'" + message,
"Search results",
JOptionPane.INFORMATION_MESSAGE);
}
}//end while
searchGloss();
}// end searchJavaGlossary()
}//end class