.Open Java Application Programmers Interface See .See http://www/dick/samples/java.html for an introduction to Java and .See http://www/csci/csusb.edu/dick/samples/java.class.tree.html for the simpler and earlier Application Programmers Interface --(API) Also check out .See http://www/csci/csusb.edu/dick/samples/java.classes.html which displays the core class hierarchicy with properties and selected fields and methods. . The Java Application Programmers Interface 1.2 The Java 1.2 API was once indexed and documented by Sun. . Notes .Set All terms defined below are names of classes unless marked $interface etc. The "@C" are the possible subsets/subtypes/extensions of class C. So .As_is Child::@Parent... indicates that Child implments or extends the Parent class. All class extend $Object by default. The name is linked to a page specifying all non-private fields and methods. This does not show "Peer", "Remote", and "Swing" classes. .Close.Set . Applets Applet::@$Panel, AppletContext::TBA AppletStub::TBA .Open User Interface Classes . Components Component::@$Object, Components in a Graphic User Interface including: $Button, $List, $TextField, $TextArea, $CheckBox, $CheckBoxGroup, $Dialog, $Frame, $Scrollbar, $Choice, $Canvas, $Frame, $Panel, $Window. Button::@$Component, Checkbox::@$Component, CheckboxGroup::@$Component, Choice::@$Component, Container::@$Component, A class of graphical User interface objects that can contain a varying number of other graphic objects ($Component). All Containers have a $LayoutManager and a way to add and remove components. Label::@$Component, List::@$Component, List of items in a scrollable window allowing the user to select one of them. Panel::@$Container, rectangular area containing other $Components? TextArea::@$TextComponent, TextComponent::@$Component, TextField::@$TextComponent, . Windows and Widgets Window::=$Dialog | $Frame, Frame::@$Window, Scrollbar::TBA. CheckboxMenuItem::TBA. Menu::TBA. MenuBar::TBA. MenuComponent::@$Object, MenuContainer::TBA. MenuItem::TBA. MenuShortCut::@$Object. . Sound AudioClip::TBA. . Colors Color::TBA. ColorModel::TBA. DirectColorModel::TBA. IndexColorModel::TBA. . Graphics Canvas::TBA. a $Component that permits graphics. CropImageFilter::TBA. FilteredImageSource::TBA. Graphics::@$Object, A Graphics object knows how to draw and fill: Rectangles (plain, 3D, or with rounded corners), ovals, arcs, lines, strings, in different $Color's, and how to clear rectangles. It uses more abstract classes such as $Point, $Dimension, and $Rectangle. Image::TBA. ImageConsumer::TBA. ImageFilter::TBA. ImageObserver::TBA. ImageProducer::TBA. PixelGrabber::TBA. Polygon::TBA. RGBImageFilter::TBA. . Layouts BorderLayout::@LayoutManager, A $LayoutManager that has a component in the center, top(north), bottom(south), left(west), and right(east) of it, or any subset of these. CardLayout::@#LayoutManager, A $LayoutManager which allows only one of its components to visible at any one time as selected by the show(...) method. FlowLayout::@#LayoutManager, A $LayoutManager a manager that places objects, in the order added across the component and then row by row. Or in columns. In each row items can be centered, left, or right aligned. GridBagConstraints::TBA. GridBagLayout::@$LayoutMananger, A $LayoutManager that is based on a grid but where each component can take up any non-overlapping (tiled) rectangular set of grid rectangles. Complex and clever. GridLayout::@$LayoutManager, A $LayoutManager that places components in a simple two dimensional grid with fixed dimensions. LayoutManager::=$BorderLayout | $CardLayout | $FlowLayout | $GridBagLayout | $GridLayout. A class of objects that can control the positioning of components inside a $Container. . Event Handling Many components(objects in class $Component) implement a function like this: `component`.add`Type`Listener(`l`) where `l` is in a class that implements the `Type`Listener interface and `Type` is a name of a type of $AWTEvent. The `Type`Listener interface defines a a void function action`something`(`Type`Listener event). The `something` varies with the `Type` of the event. Another class can define a class that implements `Type`Listener by handling the events. It constructs an object of this tpe and passes it to the component using the add`Type`Listener function. When events occur the implemented function is called with arguments defining the event. .As_is anXListener---implements--->interface----used by---->aComponent .As_is anXListener-passed by-addXListener(anXListener)-to-->aComponent .As_is anXListener<------gets called when an XEvent hits----aComponent A more detailed model using the Unified Modeling Language can be downloaded: .See http://www/dick/samples/listener.mdl and viewed with Rational Rose. To support this model Java1.2 makes it easier to construct and object and and describe its class in a single statement .See http://www/dick/samples/java/syntax/html#anonymous_class_object -- without having to name the class. AWTEvent::$abstract_class=$ActionEvent | $ItemEvent | $WindowEvent | $ComponentEvent | $AdjustmentEvent | $MouseEvent | $KeyEvent | $FocusEvent. All these events have a `getSource()` method that tells a listener which object generated the event. The event handling uses grouped classes of AWTEvents, $addListener functions, Listener interfaces, and Adapter classes. To implement one of the interfaces below the class must (1) state that it "implements Interface_name" in its header and (2) define all the functions listed in the interface. The Adapter classes supply default empty functions for the functions in the interface, so by extending an Adapter class you only have to defined the listening functions that do something. .Table Event Sent by To Added by Adapter .Row ActionEvent .Item Button,List,MenuItem,TextField .Item ActionListener:actionPerformed .Item addActionListener .Item ActionAdapter .Row AdjustmentEvent .Item Scrollbar .Item AdjustmentListener:adjustmentValueChanged .Item addAdjustmentListener .Item AdjustmentAdapter .Row ComponentEvent .Item Dialog, Frame .Item ComponentListener:componentMoved,componentHidden,componentResized,ComponentShown .Item addComponentListener .Item ComponentAdapter .Row FocusEvent .Item any Component .Item FocusListener:focusGained,focusLost .Item addFocusListener .Item FocusAdapter .Row ItemEvent .Item Checkbox,CheckboxMenuItem,Choice,List .Item ItemListener:itemStateChanged .Item addItemListener .Item ItemAdjuster .Row KeyEvent .Item any Component .Item KeyListener:keyPressed,keyReleased,keyTyped .Item addKeyListener .Item KeyAdapter .Row MouseEvent .Item Canvas,Dialog,Frame,Panel,Window. .Item MouseListener:mouseDragged,mousePressed,mouseClicked,mouseEntered,mouseExited .Item addMouseListener .Item MouseAdapter .Row WindowEvent .Item Dialog,Frame. .Item WindowListener:windowClosing, windowOpened, windowIconified,windowDeiconified,windowClosed .Item addWindowListener .Item WindowAdapter .Row MouseMovedEvent .Item etc .Close.Table ActionEvent::@$AWTEvent, sent by $Button, $List, $MenuItem, and $TextField. addActionListener::=`add $ActionListener (_) to the components list of listeners` ActionListener::$interface= { actionPerformed($ActionEvent) }. ActionAdapter::$abstract_class, provides empty functions for the interface. AdjustmentEvent::@$AWTEvent, sent by $Scrollbar addAdjustmentEvent::=`add $AdjustmentListener (_) to the components list of listeners` AdjustmentListener::$interface={ adjustmentValueChanged($AdjustmentEvent)}. AdjustmentAdapter::$abstract_class, provides empty functions for the interface. ComponentEvent::@$AWTEvent, sent by $Dialog and $Frame. addComponentListener::=`add $ComponentListener (_) to the components list of listeners` ComponentListener::$interface={componentMoved($ComponentEvent),componentHidden($ComponentEvent),componentResized($ComponentEvent),componentShown($ComponentEvent)}. ComponentAdapter::$abstract_class, provides empty functions for the interface. FocusEvent::@$AWTEvent, could be sent by any $Component. addFocusListener::=`add $FocusListener (_) to the components list of listeners` FocusListener::$interface={ focusGained($FocusEvent), focusLost($FocusEvent)}. FocusAdapter::$abstract_class, provides empty functions for the interface. ItemEvent::@$AWTEvent, sent by objects in classes $Checkbox, $CheckboxMenuItem, $Choice, $List. addItemListener::=`add $ItemListener (_) to the components list of listeners` ItemListener::$interface={ itemStateChanged($ItemEvent) }. ItemAdapter::$abstract_class, provides empty functions for the interface. IOEvent::=$KeyEvent | $MouseEvent. KeyEvent::@$AWTEvent, can be sent by any object in class $Component. addKeyListener::=`add $KeyListener (_) to the components list of listeners` KeyListener::$interface={ keyPressed($KeyEvent), keyReleased($KeyEvent). keyTyped($KeyEvent)} KeyAdapter::$abstract_class, provides empty functions for the interface. MouseEvent::@$AWTEvent, Can be sent by objects that are: $Canvas, $Dialog, $Frame, $Panel, $Window. addMouseListener::=`add $MouseListener (_) to the components list of listeners` MouseListener::$interface={ mouseDragged($MouseEvent),mousePressed($MouseEvent),mouseClicked($MouseEvent),mouseEntered($MouseEvent),mouseExited($MouseEvent)}. MouseAdapter::$abstract_class, provides empty functions for the interface. There is also a set of MouseMovedEvents... WindowEvent::@$AWTEvent, can be sent by objects in $Dialog and $Frame. addWindowListener::=`add $WindowListener (_) to the components list of listeners` WindowListener::$interface={ windowClosing($WindowEvent), windowOpened($WindowEvent), windowIconified($WindowEvent),windowDeiconified($WindowEvent),windowClosed($WindowEvent)}. WindowAdapter::$abstract_class, provides empty functions for the interface. . Swing Swing is a new and powerful set of "light weight" classes for producing user interfaces. It is unwise to mix the older AWT and newer Swing classes -- especially avoid placing or adding a heavyweight AWT component into a lightweight one. Swing is part of the Java Foundation Classes --(JVC). The Swing classes use the `MVC` pattern: MVC::="Model, View and Controller", originally develope for Smalltalk. The "View" encapsulates how data is displayed. It accesses data held in a separate "Model" class. If the "Model" data changes then the "View" is informed and redisplays the new data. The "Controller" determines how the user interacts with the data in the Model and so changes. The "View" is responsible for sending gestures and events to the controller which, in turn, requests changes in the model,... JComponent::@$Container. JList::@$JComponent=$TBA. JMenuBar::@$JComponent=$TBA. JOptionPane::@$JComponent=$TBA. JPanel::@$JComponent=$TBA. JPopupMenu::@$JComponent=$TBA. JProgessBar::@$JComponent=$TBA. JRootPanel::@$JComponent=$TBA. JScrollBar::@$JComponent=$TBA. JSlider::@$JComponent=$TBA. JScrollPane::@$JComponent=$TBA. JTabbedPane::@$JComponent=$TBA. JTableHeader::@$JComponent=$TBA. JToolBar::@$JComponent=$TBA. JTree::@$JComponent=$TBA. AbstractButton::@$JComponent=$TBA. JToggleButton::@$AbstractButton=$TBA. JCheckBox::@$JToggleButton=$TBA. JRadioButton::@$JToggleButton=$TBA. JButton::@$AbstractButton=$TBA. JMenuItem::@$AbstractButton=$TBA. JCheckBoxMenuItem::@$JMenuItem=$TBA. JMenu::@$JMenuItem=$TBA. JRadioButtonMenuItem::@$JMenuItem=$TBA. JColorChooser::@$JComponent=$TBA. JComboBox::@$JComponent=$TBA. JDesktopIcon::@$JComponent=$TBA. JFileChooser::@$JComponent=$TBA. JLabel::@$JComponent=$TBA. JInternalFrame::@$JComponent=$TBA. JLayeredFrame::@$JComponent=$TBA. See $JDesktoPlane. JDesktopPane::@$JLayeredPane=$TBA. JSeparator::@$JComponent=$TBA. JSplitPane::@$JComponent=$TBA. JTable::@$JComponent=$TBA. JToolTip::@$JComponent=$TBA. JViewPort::@$JComponent=$TBA. JTextComponent::@$JComponent=$TBA. Extended as $JTextComponent, $JTextField, $JEditorPane. JTextArea::@$JTextComponent=$TBA. JTextField::@$JTextComponent=$TBA. JEditorPane::@$JTextComponent=$TBA. JPasswordField::@$JTextArea=$TBA. .Close User Interface Classes .Open Input/Output BufferedInputStream::TBA. BufferedOutputStream::TBA. ByteArrayInputStream::TBA. ByteArrayOutputStream::TBA. DataInput::TBA. DataInputStream::TBA. DataOutput::TBA. DataOutputStream::TBA. File::TBA. FileDescriptor::TBA. FileDialog::TBA. FileInputStream::TBA. FilenameFilter::TBA. FileOutputStream::TBA. FilterInputStream::TBA. FilterOutputStream::TBA. Reader::$abstract_class=$BufferedReader | $CharArrayReader | $FileReader | $PipedReader | $StringReader. BufferedReader::@$Reader. CharArrayReader::@$Reader. FileReader::@$Reader. PipedReader::@$Reader. StringReader::@$Reader. Writer::$abstract_class=$BufferedWriter | $CharArrayWriter | $FileWriter | $PipedWriter | $StringWriter. BufferedWriter::@$Writer. CharArrayWriter::@$Writer. FileWriter::@$Writer. PipedWriter::@$Writer. StringWriter::@$Writer. InputStream::TBA. LineNumberInputStream::TBA. OutputStream::TBA. PipedInputStream::TBA. PipedOutputStream::TBA. PrintStream::TBA. PushbackInputStream::TBA. RandomAccessFile::TBA. SequenceInputStream::TBA. StreamTokenizer::TBA. StringBufferInputStream::TBA. .Closed Input/Output Classes . Networking DatagramPacket::TBA. DatagramSocket::TBA. InetAddress::TBA. ServerSocket::TBA. Socket::TBA. SocketImpl::TBA. SocketImplFactory::TBA. URL::TBA. URLConnection::TBA. URLEncoder::TBA. URLStreamHandler::TBA. URLStreamHandlerFactory::TBA. .Open General Purpose Classes BitSet::TBA. Boolean::TBA. Character::TBA. reference to a 16bit Unicode symbol. Class::TBA. ClassLoader::TBA. Cloneable::$interface. A Cloneable class implments a clone() function to create copies of the object they apply to. Compiler::TBA. ContentHandler::TBA. ContentHandlerFactory::TBA. Date::TBA. DebuggerCallback::TBA. Dictionary::@$HashTable, Dimension::TBA. This is an object that can keep track of the int `width` and `hieght` of something. Double::TBA. reference to a double length number. Enumeration::TBA. Java's iterator. Event::TBA. Float::TBA. single length floating point object. Font::@$Object, In JDK1.0 the commonest fonts are Helvetica, TimeRoman, and Courier which caused copyright problems. The names have been changed to SanSerif, Serif, and Monospaced in JDK1.1. This class also defines constants like Font.BOLD, Font.ITALIC, and Font.PLAIN. FontMetrics::TBA. Hashtable::@$Object, $Dictionary is an extension of $HashTable, Insets::TBA. Integer::TBA. LocalVariable::TBA. Long::TBA. a reference to a long integer item of data. Math::TBA. a collection of useful functions and constants. MediaTracker::TBA. MemoryImageSource::TBA. Number::TBA. superclass of $Double, $Float, $Integer, ... Object::TBA. the grand-parent of all classes. Observable::TBA. Observer::TBA. Point::@$Object, This is not a graphic object but a mathematical object with two integer coordinates called x and y. Process::TBA. Properties::@Dictionary, Random::TBA. Rectangle::TBA. this not a graphic object but a record of two co-ordinates (x and y) and a pair of dimensions(width and hieght). It comes with a lot of operations including intersection and union. Runnable::TBA. $interface for Classes of objects that have a public void run() function. A $Runnable object can be execute by a $Thread object in a separate concurrent thread of control. Runtime::TBA. RuntimeConstants::TBA. SecurityManager::TBA. Stack::TBA. a specialized $Vector. String::TBA. a fixed sequence of characters. StringBuffer::TBA. a variable sequence of characters. StringTokenizer::TBA. System::TBA. Thread::TBA. ThreadDeath::TBA. ThreadGroup::TBA. Toolkit::TBA. Vector::TBA. a dynamic array. .Close General Purpose Classes . Errors and Exceptions Throwable::=$Exception | $Error, includes Exceptions and Errors, Something that can appear in throw and catch statements. .Set Error::TBA. Exception::TBA. unuusual situations things that a normal programmer can be expected to sort out. .Set RuntimeException::TBA. things that a programmer may explicitly catching or throwing. Other exceptions either have to be caught or the code must decalre that it throws them. .Close.Set .Close.Set AbstractMethodError::@$Error, ArithmeticException::TBA. ArrayIndexOutOfBoundsException::TBA. ArrayStoreException::TBA. AWTError::@$Error, AWTException::TBA. ClassCastException::TBA. ClassCircularityError::@$Error, ClassFormatError::@$Error, ClassNotFoundException::TBA. CloneNotSupportedException::TBA. EmptyStackException::TBA. EOFException::TBA. IllegalAccessError::@$Error, IllegalAccessException::TBA. IllegalArgumentException::TBA. IllegalMonitorStateException::TBA. IllegalThreadStateException::TBA. IncompatibleClassChangeError::@$Error, IndexOutOfBoundsException::TBA. InstantiationError::@$Error, InstantiationException::TBA. InternalError::@$Error, InterruptedException::TBA. InterruptedIOException::TBA. IOException::TBA. LinkageError::@$Error, MalformedURLException::TBA. NegativeArraySizeException::TBA. NoClassDefFoundError::@$Error, NoSuchElementException::TBA. NoSuchFieldError::@$Error, NoSuchMethodError::@$Error, NoSuchMethodException::TBA. NullPointerException::TBA. NumberFormatException::TBA. OutOfMemoryError::@$Error, ProtocolException::TBA. SecurityException::TBA. SocketException::TBA. StackOverflowError::@$Error, StringIndexOutOfBoundsException::TBA. UnknownError::@$Error, UnknownHostException::TBA. UnknownServiceException::TBA. UnsatisfiedLinkError::@$Error, UTFDataFormatException::TBA. VerifyError::@$Error, VirtualMachineError::@$Error, . Glossary TBA::="To Be Announced". abstract_class::=`A class with one or more abstract functions. No objects can be made for this class but there can be references to abstract_classes and classes derived from them that are not abstract. interface::=`a list of public abstract methods(functions) that other classes can implement. A variable can refer to any object that implements an interface but no objects can be created for an interface directly`. .Close Java Application Programmers Interface