javabog.dk  |  << forrige  |  indhold  |  næste >>  |  programeksempler  |  om bogen

12 Standardbiblioteket (J2SE)


12.1 Grundlæggende klasser (java.lang) 160

12.1.1 Klasser, der svarer til de simple typer 160

12.1.2 Tråde 161

12.1.3 Introspektion og dynamisk klasseindlæsning 161

12.1.4 Svage referencer (java.lang.ref) 162

12.1.5 Matematik med vilkårlig præcision (java.math) 162

12.2 Værktøjsklasser (java.util) 162

12.2.1 De "klassiske" datastrukturer i java.util 163

12.2.2 Collections-klasserne i java.util 164

12.3 Behandling af tekst (java.text) 165

12.4 Grafiktegning (java.awt del 1) 166

12.4.1 Generelt 166

12.4.2 Grafiktegning (Java2D) 167

12.4.3 Udskrivning 169

12.5 Grafiske brugergrænseflader (java.awt del 2) 170

12.5.1 Grafiske komponenter i java.awt 170

12.5.2 Containere i java.awt 171

12.5.3 Appletter (pakken java.applet) 171

12.5.4 Layout-managere i java.awt 171

12.5.5 Hændelser i java.awt 171

12.5.6 Menuer i java.awt 173

12.5.7 Kopiering, udklipsholder og træk-og-slip 173

12.6 Lyd 174

12.6.1 WAV/indspillet lyd (javax.sound.sampled) 174

12.6.2 MIDI/nodebaseret musik (javax.sound.midi) 175

12.7 Netværkskommunikation (java.net) 177

12.8 Databasekommunikation (java.sql) 178

12.9 Fjernkald af metoder (java.rmi) 179

12.10 Sikkerhed, kryptering, adgangskontrol (java.security) 180

Dette kapitel giver en oversigt over de mest brugte dele af standardbiblioteket (kaldet J2SE - Java 2 Standard Edition). Pakkerne og klasserne er ikke, som i den normale javadokumentation, sorteret alfabetisk, men i stedet ordnet efter nytteværdi og emne.

Kapitlet findes også i netudgaven af bogen, http://javabog.dk/VP, hvor hver klasse henviser til Suns javadokumentation, så du ved at klikke på klassen kan læse mere om den.

Klasser er skrevet med almindelig skrift, mens interfaces er skrevet i kursiv. Undtagelser er ikke medtaget. Ligeledes er frarådede klasser (markeret med deprecated) og klasser og pakker kun beregnet til internt brug ikke medtaget.

12.1 Grundlæggende klasser (java.lang)

Object Class Object is the root of the class hierarchy.

String The String class represents character strings.

StringBuffer A string buffer implements a mutable sequence of characters.

System The System class contains several useful class fields and methods.

Runtime Every Java application has a single instance of class Runtime that allows the application to interface with the environment in which the application is running.

RuntimePermission This class is for runtime permissions.

Process The Runtime.exec methods create a native process and return an instance of a subclass of Process that can be used to control the process and obtain information about it.

SecurityManager The security manager allows applications to implement a security policy.

Math The class Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.

StrictMath The class StrictMath contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.

Cloneable A class implements the Cloneable interface to indicate to the Object.clone() method that it is legal for that method to make a field-for-field copy of instances of that class.

Comparable This interface imposes a total ordering on the objects of each class that implements it.

12.1.1 Klasser, der svarer til de simple typer

Boolean The Boolean class wraps a value of the primitive type boolean in an object.

Byte The Byte class is the standard wrapper for byte values.

Character The Character class wraps a value of the primitive type char in an object.

Character.Subset Instances of this class represent particular subsets of the Unicode character set.

Character.UnicodeBlock A family of character subsets representing the character blocks defined by the Unicode 2.0 specification.

Double The Double class wraps a value of the primitive type double in an object.

Float The Float class wraps a value of primitive type float in an object.

Integer The Integer class wraps a value of the primitive type int in an object.

Long The Long class wraps a value of the primitive type long in an object.

Number The abstract class Number is the superclass of classes Byte, Double, Float, Integer, Long, and Short.

Short The Short class is the standard wrapper for short values.

12.1.2 Tråde

Runnable The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread.

Thread A thread is a thread of execution in a program.

ThreadGroup A thread group represents a set of threads.

ThreadLocal This class provides ThreadLocal variables.

InheritableThreadLocal This class extends ThreadLocal to provide inheritance of values from parent Thread to child Thread: when a child thread is created, the child receives initial values for all InheritableThreadLocals for which the parent has values.

Hvis en metode skal kaldes efter et stykke tid eller med regelmæssige tidsintervaller: Se også java.util.Timer og java.util.TimerTask for et alternativ til at arbejde direkte med tråde.

Hvis du bruger Swing: Bemærk, at efter et vindue er blevet synligt, bør du ikke kalde metoder i grafiske komponenter fra andre tråde end GUI-tråden. Den kan du aktivere med metoderne invokeLater() og invokeAndWait() på javax.swing.SwingUtilities.

12.1.3 Introspektion og dynamisk klasseindlæsning

Se også kapitel 11.

Class Instances of the class Class represent classes and interfaces in a running Java application.

ClassLoader The class ClassLoader is an abstract class.

Compiler The Compiler class is provided to support Java-to-native-code compilers and related services.

Package Package objects contain version information about the implementation and specification of a Java package.

Void The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the primitive Java type void.

Pakken java.lang.reflect har hjælpeklasser til introspektion:

Member Member is an interface that reflects identifying information about a single member (a field or a method) or a constructor.

AccessibleObject This is the base class for Field, Method and Constructor objects.

Field A Field provides information about, and dynamic access to, a single field of a class or an interface.

Method A Method provides information about, and access to, a single method on a class or interface.

Constructor Constructor provides information about, and access to, a single constructor for a class.

Array The Array class provides static methods to dynamically create and access Java arrays.

Modifier The Modifier class provides static methods and constants to decode class and member access modifiers.

InvocationHandler InvocationHandler is the interface implemented by the invocation handler of a proxy instance.

Proxy Proxy provides static methods for creating dynamic proxy classes and instances, and it is also the superclass of all dynamic proxy classes created by those methods.

ReflectPermission The Permission class for reflective operations.

I pakken java.beans findes en række hjælpeklasser til introspektion af javabønner.

12.1.4 Svage referencer (java.lang.ref)

Normalt kan et objekt kun blive smidt væk (frigivet fra hukommelsen), hvis der ikke er nogen referencer til det.

Svage referencer (eng.: weak references) er specielle objektreferencer, hvor det refererede objekt godt (i tilfælde af hukommelsesmangel) kan blive frigivet. Bruger man svage referencer, har man altså mulighed for at have objekter der bliver smidt væk i tilfælde af hukommelsesmangel.

Reference Abstract base class for reference objects.

WeakReference Weak reference objects, which do not prevent their referents from being made finalizable, finalized, and then reclaimed.

SoftReference Soft reference objects, which are cleared at the discretion of the garbage collector in response to memory demand.

PhantomReference Phantom reference objects, which are enqueued after the collector determines that their referents may otherwise be reclaimed.

ReferenceQueue Reference queues, to which registered reference objects are appended by the garbage collector after the appropriate reachability changes are detected.

12.1.5 Matematik med vilkårlig præcision (java.math)

Denne pakke (ikke at forveksle med den hyppigst brugte matematikklasse java.lang.Math) er beregnet til regning med vilkårligt antal decimaler. Den indeholder kun to klasser:

BigDecimal Immutable, arbitrary-precision signed decimal numbers.

BigInteger Immutable arbitrary-precision integers.

12.2 Værktøjsklasser (java.util)

Indeholder en række værktøjsklasser, dato- og tidsfaciliteter, internationalisering og en masse datastrukturer.

Random An instance of this class is used to generate a stream of pseudorandom numbers.

StringTokenizer The string tokenizer class allows an application to break a string into tokens.

Timer A facility for threads to schedule tasks for future execution in a background thread.

TimerTask A task that can be scheduled for one-time or repeated execution by a Timer.

Date The class Date represents a specific instant in time, with millisecond precision.

Calendar Calendar is an abstract base class for converting between a Date object and a set of integer fields such as YEAR, MONTH, DAY, HOUR, and so on.

GregorianCalendar GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar used by most of the world.

TimeZone TimeZone represents a time zone offset, and also figures out daylight savings.

SimpleTimeZone SimpleTimeZone is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar.

Locale A Locale object represents a specific geographical, political, or cultural region.

ResourceBundle Resource bundles contain locale-specific objects.

PropertyResourceBundle PropertyResourceBundle is a concrete subclass of ResourceBundle that manages resources for a locale using a set of static strings from a property file.

ListResourceBundle ListResourceBundle is a abstract subclass of ResourceBundle that manages resources for a locale in a convenient and easy to use list.

Properties The Properties class represents a persistent set of properties.

PropertyPermission This class is for property permissions.

EventObject The root class from which all event state objects shall be derived.

EventListener A tagging interface that all event listener interfaces must extend.

Observable This class represents an observable object, or "data" in the model-view paradigm.

Observer A class can implement the Observer interface when it wants to be informed of changes in observable objects.

12.2.1 De "klassiske" datastrukturer i java.util

Disse datastrukturer har eksisteret siden JDK 1.0:

Comparator A comparison function, which imposes a total ordering on some collection of objects.

Enumeration An object that implements the Enumeration interface generates a series of elements, one at a time.

BitSet This class implements a vector of bits that grows as needed.

Dictionary The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to values.

Hashtable This class implements a hashtable, which maps keys to values.

Stack The Stack class represents a last-in-first-out (LIFO) stack of objects.

Vector The Vector class implements a growable array of objects.

12.2.2 Collections-klasserne i java.util

Disse datastrukturer kom til i JDK 1.2. Mange af dem er beskrevet i kapitel 1.

Collections This class consists exclusively of static methods that operate on or return collections.

Arrays This class contains various methods for manipulating arrays (such as sorting and searching).

Collection The root interface in the collection hierarchy.

AbstractCollection This class provides a skeletal implementation of the Collection interface, to minimize the effort required to implement this interface.

Iterator An iterator over a collection.

ListIterator An iterator for lists that allows the programmer to traverse the list in either direction and modify the list during iteration.

Lister (datastrukturer hvor rækkefølgen af elementerne huskes):

List An ordered collection (also known as a sequence).

AbstractList This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a "random access" data store (such as an array).

ArrayList Resizable-array implementation of the List interface.

AbstractSequentialList This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a "sequential access" data store (such as a linked list).

LinkedList Linked list implementation of the List interface.

Mængder (datastrukturer hvor rækkefølgen af elementerne ikke huskes)

Set A collection that contains no duplicate elements.

AbstractSet This class provides a skeletal implementation of the Set interface to minimize the effort required to implement this interface.

HashSet This class implements the Set interface, backed by a hash table (actually a HashMap instance).

SortedSet A set that further guarantees that its iterator will traverse the set in ascending element order, sorted according to the natural ordering of its elements (see Comparable), or by a Comparator provided at sorted set creation time.

TreeSet This class implements the Set interface, backed by a TreeMap instance.


Afbildninger (datastrukturer hvor nøglen er et objekt)

Map An object that maps keys to values.

Map.Entry A map entry (key-value pair).

AbstractMap This class provides a skeletal implementation of the Map interface, to minimize the effort required to implement this interface.

HashMap Hash table based implementation of the Map interface.

WeakHashMap A hashtable-based Map implementation with weak keys.

SortedMap A map that further guarantees that it will be in ascending key order, sorted according to the natural ordering of its keys (see the Comparable interface), or by a comparator provided at sorted map creation time.

TreeMap Red-Black tree based implementation of the SortedMap interface.

12.3 Behandling af tekst (java.text)

Formatering og parsning af tekst, datoer og tal.

Format Format is an abstract base class for formatting locale-sensitive information such as dates, messages, and numbers.

FieldPosition FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted output.

ParsePosition ParsePosition is a simple class used by Format and its subclasses to keep track of the current position during parsing.

ChoiceFormat A ChoiceFormat allows you to attach a format to a range of numbers.

DateFormat DateFormat is an abstract class for date/time formatting subclasses which formats and parses dates or time in a language-independent manner.

SimpleDateFormat SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner.

DateFormatSymbols DateFormatSymbols is a public class for encapsulating localizable date-time formatting data, such as the names of the months, the names of the days of the week, and the time zone data.

DecimalFormat DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers.

DecimalFormatSymbols This class represents the set of symbols (such as the decimal separator, the grouping separator, and so on) needed by DecimalFormat to format numbers.

MessageFormat MessageFormat provides a means to produce concatenated messages in language-neutral way.

NumberFormat NumberFormat is the abstract base class for all number formats.

Sortering af strenge (afhængigt af sprog)

Collator The Collator class performs locale-sensitive String comparison.

CollationKey A CollationKey represents a String under the rules of a specific Collator object.

RuleBasedCollator The RuleBasedCollator class is a concrete subclass of Collator that provides a simple, data-driven, table collator.

Klasser til at gennemløbe tekst (afhængigt af sprog)

CharacterIterator This interface defines a protocol for bidirectional iteration over text.

StringCharacterIterator StringCharacterIterator implements the CharacterIterater protocol for a String.

BreakIterator The BreakIterator class implements methods for finding the location of boundaries in text.

AttributedCharacterIterator An AttributedCharacterIterator allows iteration through both text and related attribute information.

AttributedCharacterIterator.Attribute Defines attribute keys that are used to identify text attributes.

Annotation An Annotation object is used as a wrapper for a text attribute value if the attribute has annotation characteristics.

AttributedString An AttributedString holds text and related attribute information.

CollationElementIterator The CollationElementIterator class is used as an iterator to walk through each character of an international string.

12.4 Grafiktegning (java.awt del 1)

12.4.1 Generelt

Graphics The Graphics class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off-screen images.

Color The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary color spaces identified by a ColorSpace.

Point A point representing a location in (x, y) coordinate space, specified in integer precision.

Dimension The Dimension class encapsulates the width and height of a component (in integer precision) in a single object.

Rectangle A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-left point (xy) in the coordinate space, its width, and its height.

Polygon The Polygon class encapsulates a description of a closed, two-dimensional region within a coordinate space.

Font The Font class represents a font.

FontTMetrics The FontMetrics class defines a font metrics object, which encapsulates information about the rendering of a particular font on a particular screen.

Image The abstract class Image is the superclass of all classes that represent graphical images.

MediaTracker The MediaTracker class is a utility class to track the status of a number of media objects.

Cursor A class to encapsulate the bitmap representation of the mouse cursor.

12.4.2 Grafiktegning (Java2D)

De følgende klasser til avanceret 2D-grafik kaldes under et 'Java2D'. Se også kapitel 5.

Graphics2D This Graphics2D class extends the Graphics class to provide more sophisticated control over geometry, coordinate transformations, color management, and text layout.

Composite The Composite interface, along with CompositeContext , defines the methods to compose a draw primitive with the underlying graphics area.

CompositeContext The CompositeContext interface defines the encapsulated and optimized environment for a compositing operation.

AlphaComposite This AlphaComposite class implements the basic alpha compositing rules for combining source and destination pixels to achieve blending and transparency effects with graphics and images.

Shape The Shape interface provides definitions for objects that represent some form of geometric shape.

Stroke The Stroke interface allows a Graphics2D object to obtain a Shape that is the decorated outline, or stylistic representation of the outline, of the specified Shape.

BasicStroke The BasicStroke class defines a basic set of rendering attributes for the outlines of graphics primitives.

Transparency The Transparency interface defines the common transparency modes for implementing classes.

Paint This Paint interface defines how color patterns can be generated for Graphics2D operations.

PaintContext The PaintContext interface defines the encapsulated and optimized environment to generate color patterns in device space for fill or stroke operations on a Graphics2D.

GradientPaint The GradientPaint class provides a way to fill a Shape with a linear color gradient pattern.

TexturePaint The TexturePaint class provides a way to fill a Shape with a texture that is specified as a BufferedImage.

GraphicsConfiguration The GraphicsConfiguration class describes the characteristics of a graphics destination such as a printer or monitor.

GraphicsConfigTemplate The GraphicsConfigTemplate class is used to obtain a valid GraphicsConfiguration.

GraphicsDevice The GraphicsDevice class describes the graphics devices that might be available in a particular graphics environment.

GraphicsEnvironment The GraphicsEnvironment class describes the collection of GraphicsDevice objects and Font objects available to a Java(tm) application on a particular platform.

RenderingHints The RenderingHints class contains rendering hints that can be used by the Graphics2D class, and classes that implement BufferedImageOp and Raster.

RenderingHints.Key Defines the base type of all keys used to control various aspects of the rendering and imaging pipelines.

Pakken java.awt.font indeholder forskellige klasser og interfaces til nøjere undersøgelse og manipulation af skrifter.

Pakken java.awt.image indeholder funktioner til at oprette og manipulere med billeder.

Pakken java.awt.geom indeholder klasser og interfaces til undersøgelse og manipulation af geometriske former:

AffineTransform The AffineTransform class represents a 2D affine transform that performs a linear mapping from 2D coordinates to other 2D coordinates that preserves the "straightness" and "parallelness" of lines.

Arc2D The abstract superclass for all objects that store a 2D arc defined by a bounding rectangle, start angle, angular extent (length of the arc), and a closure type (OPEN, CHORD, or PIE).

Arc2D.Double An arc specified in double precision,

Arc2D.Float An arc specified in float precision,

Area The Area class is a device-independent specification of an arbitrarily-shaped area.

CubicCurve2D This class defines a cubic parametric curve segment in (x,  y) coordinate space.

CubicCurve2D.Double A cubic parametric curve segment specified with double coordinates.

CubicCurve2D.Float A cubic parametric curve segment specified with float coordinates.

Dimension2D The Dimension2D class is to encapsulate a width and a height dimension.

Ellipse2D The Ellipse2D class describes an ellipse that is defined by a bounding rectangle.

Ellipse2D.Double The Double class defines an ellipse specified in double precision.

Ellipse2D.Float The Float class defines an ellipse specified in float precision.

FlatteningPathIterator This class returns a flattened view of another PathIterator object.

GeneralPath The GeneralPath class represents a geometric path constructed from straight lines, and quadratic and cubic (Bézier) curves.

Line2D This Line2D represents a line segment in (x, y) coordinate space.

Line2D.Double A line segment specified with double coordinates.

Line2D.Float A line segment specified with float coordinates.

Point2D The Point2D class defines a point representing a location in (x, y) coordinate space.

Point2D.Double The Double class defines a point specified in double precision.

Point2D.Float The Float class defines a point specified in float precision.

QuadCurve2D The QuadCurve2D class defines a quadratic parametric curve segment in (x, y) coordinate space.

QuadCurve2D.Double A quadratic parametric curve segment specified with double coordinates.

QuadCurve2D.Float A quadratic parametric curve segment specified with float coordinates.

Rectangle2D The Rectangle2D class describes a rectangle defined by a location (x, y) and dimension (w x h).

Rectangle2D.Double The Double class defines a rectangle specified in double coordinates.

Rectangle2D.Float The Float class defines a rectangle specified in float coordinates.

RectangularShape RectangularShape is the base class for a number of Shape objects whose geometry is defined by a rectangular frame.

RoundRectangle2D The RoundRectangle2D class defines a rectangle with rounded corners defined by a location (x, y), a dimension (w x h), and the width and height of an arc with which to round the corners.

RoundRectangle2D.Double The Double class defines a rectangle with rounded corners all specified in double coordinates.

RoundRectangle2D.Float The Float class defines a rectangle with rounded corners all specified in float coordinates.

12.4.3 Udskrivning

Pakken java.awt indeholder følgende klasser til håndtering af udskrivning:

PrintJob An abstract class which initiates and executes a print job.

JobAttributes A set of attributes which control a print job.

JobAttributes.DefaultSelectionType A type-safe enumeration of possible default selection states.

JobAttributes.DestinationType A type-safe enumeration of possible job destinations.

JobAttributes.DialogType A type-safe enumeration of possible dialogs to display to the user.

JobAttributes.MultipleDocumentHandlingType A type-safe enumeration of possible multiple document handling states.

JobAttributes.SidesType A type-safe enumeration of possible multi-page impositions.

PageAttributes A set of attributes which control the output of a printed page.

PageAttributes.ColorType A type-safe enumeration of possible color states.

PageAttributes.MediaType A type-safe enumeration of possible paper sizes.

PageAttributes.OrientationRequestedType A type-safe enumeration of possible orientations.

PageAttributes.OriginType A type-safe enumeration of possible origins.

PageAttributes.PrintQualityType A type-safe enumeration of possible print qualities.

Pakken java.awt.print, der kom til med JDK 1.2, indeholder:

Pageable The Pageable implementation represents a set of pages to be printed.

Printable The Printable interface is implemented by the print methods of the current page painter, which is called by the printing system to render a page.

PrinterGraphics The PrinterGraphics interface is implemented by Graphics objects that are passed to Printable objects to render a page.

Book The Book class provides a representation of a document in which pages may have different page formats and page painters.

PageFormat The PageFormat class describes the size and orientation of a page to be printed.

Paper The Paper class describes the physical characteristics of a piece of paper.

PrinterJob The PrinterJob class is the principal class that controls printing.

12.5 Grafiske brugergrænseflader (java.awt del 2)

De avancerede grafiske brugergrænseflader man kan lave med Swing-klasserne (pakken javax.swing) er af pladshensyn ikke beskrevet her.

Toolkit This class is the abstract superclass of all actual implementations of the Abstract Window Toolkit.

SystemColor A class to encapsulate symbolic colors representing the color of GUI objects on a system.

Robot This class is used to generate native system input events for the purposes of test automation, self-running demos, and other applications where control of the mouse and keyboard is needed.

Bemærk at klassen Robot også fange et udsnit af skærmen og gemme i et billede (fungere som screen grabber).

12.5.1 Grafiske komponenter i java.awt

Component A component is an object having a graphical representation that can be displayed on the screen and that can interact with the user.

De følgende arver alle fra Component

Button This class creates a labeled button.

Canvas A Canvas component represents a blank rectangular area of the screen onto which the application can draw or from which the application can trap input events from the user.

Checkbox A check box is a graphical component that can be in either an "on" (true) or "off" (false) state.

CheckboxGroup The CheckboxGroup class is used to group together a set of Checkbox buttons.

CheckboxMenuItem This class represents a check box that can be included in a menu.

Choice The Choice class presents a pop-up menu of choices.

Scrollbar The Scrollbar class embodies a scroll bar, a familiar user-interface object.

TextComponent The TextComponent class is the superclass of any component that allows the editing of some text.

TextArea A TextArea object is a multi-line region that displays text.

TextField A TextField object is a text component that allows for the editing of a single line of text.

Label A Label object is a component for placing text in a container.

List The List component presents the user with a scrolling list of text items.

12.5.2 Containere i java.awt

Container A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT components.

Panel Panel is the simplest container class.

ScrollPane A container class which implements automatic horizontal and/or vertical scrolling for a single child component.

Window A Window object is a top-level window with no borders and no menubar.

Frame A Frame is a top-level window with a title and a border.

Dialog A Dialog is a top-level window with a title and a border that is typically used to take some form of input from the user.

FileDialog The FileDialog class displays a dialog window from which the user can select a file.

12.5.3 Appletter (pakken java.applet)

Denne pakke indeholder klassen Applet og et par hjælpeklasser.

12.5.4 Layout-managere i java.awt

BorderLayout A border layout lays out a container, arranging and resizing its components to fit in five regions: north, south, east, west, and center.

CardLayout A CardLayout object is a layout manager for a container.

FlowLayout A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph.

GridLayout The GridLayout class is a layout manager that lays out a container's components in a rectangular grid.

GridBagLayout The GridBagLayout class is a flexible layout manager that aligns components vertically and horizontally, without requiring that the components be of the same size.

GridBagConstraints The GridBagConstraints class specifies constraints for components that are laid out using the GridBagLayout class.

Insets An Insets object is a representation of the borders of a container.

12.5.5 Hændelser i java.awt

AWTEvent The root event class for all AWT events.

Pakken java.awt.event

De fleste hændelser og lyttere findes i pakken java.awt.event:

ActionListener The listener interface for receiving action events.

AdjustmentListener The listener interface for receiving adjustment events.

AWTEventListener The listener interface for receiving notification of events dispatched to objects that are instances of Component or MenuComponent or their subclasses.

ComponentListener The listener interface for receiving component events.

ContainerListener The listener interface for receiving container events.

FocusListener The listener interface for receiving keyboard focus events on a component.

HierarchyBoundsListener The listener interface for receiving ancestor moved and resized events.

HierarchyListener The listener interface for receiving hierarchy changed events.

InputMethodListener The listener interface for receiving input method events.

ItemListener The listener interface for receiving item events.

KeyListener The listener interface for receiving keyboard events (keystrokes).

MouseListener The listener interface for receiving "interesting" mouse events (press, release, click, enter, and exit) on a component.

MouseMotionListener The listener interface for receiving mouse motion events on a component.

TextListener The listener interface for receiving text events.

WindowListener The listener interface for receiving window events.

ActionEvent A semantic event which indicates that a component-defined action occured.

AdjustmentEvent The adjustment event emitted by Adjustable objects.

ComponentAdapter An abstract adapter class for receiving component events.

ComponentEvent A low-level event which indicates that a component moved, changed size, or changed visibility (also, the root class for the other component-level events).

ContainerAdapter An abstract adapter class for receiving container events.

ContainerEvent A low-level event which indicates that a container's contents changed because a component was added or removed.

FocusAdapter An abstract adapter class for receiving keyboard focus events.

FocusEvent A low-level event which indicates that a component has gained or lost the keyboard focus.

HierarchyBoundsAdapter An abstract adapter class for receiving ancestor moved and resized events.

HierarchyEvent An event which indicates a change to the Component hierarchy to which a Component belongs.

InputEvent The root event class for all component-level input events.

InputMethodEvent Input method events contain information about text that is being composed using an input method.

InvocationEvent An event which executes the run() method on a Runnable when dispatched by the AWT event dispatcher thread.

ItemEvent A semantic event which indicates that an item was selected or deselected.

KeyAdapter An abstract adapter class for receiving keyboard events.

KeyEvent An event which indicates that a keystroke occurred in a component.

MouseAdapter An abstract adapter class for receiving mouse events.

MouseEvent An event which indicates that a mouse action occurred in a component.

MouseMotionAdapter An abstract adapter class for receiving mouse motion events.

PaintEvent The component-level paint event.

TextEvent A semantic event which indicates that an object's text changed.

WindowAdapter An abstract adapter class for receiving window events.

WindowEvent A low-level event which indicates that a window has changed its status.

12.5.6 Menuer i java.awt

Menu A Menu object is a pull-down menu component that is deployed from a menu bar.

MenuBar The MenuBar class encapsulates the platform's concept of a menu bar bound to a frame.

MenuComponent The abstract class MenuComponent is the superclass of all menu-related components.

MenuItem All items in a menu must belong to the class MenuItem, or one of its subclasses.

MenuShortcut A class which represents a keyboard accelerator for a MenuItem.

PopupMenu A class that implements a menu which can be dynamically popped up at a specified position within a component.

12.5.7 Kopiering, udklipsholder og træk-og-slip

java.awt.datatransfer

Pakken java.awt.datatransfer med bl.a. klassen Clipboard arbejder med udklipsholderen og overførsel af data til/fra andre programmer.

java.awt.dnd

Pakken java.awt.dnd sørger for funktionalitet til, at brugeren kan trække data fra et sted til et andet (Drag 'N' Drop).

12.6 Lyd

12.6.1 WAV/indspillet lyd (javax.sound.sampled)

Denne pakke tillader at optage, behandle og afspille samplet lyd (f.eks. WAV-filer).

Clip The Clip interface represents a special kind of data line whose audio data can be loaded prior to playback, instead of being streamed in real time.

DataLine DataLine adds media-related functionality to its superinterface, Line.

Line The Line interface represents a mono or multi-channel audio feed.

LineListener Instances of classes that implement the LineListener interface can register to receive events when a line's status changes.

Mixer A mixer is an audio device with one or more lines.

Port Ports are simple lines for input or output of audio to or from audio devices.

SourceDataLine A source data line is a data line to which data may be written.

TargetDataLine A target data line is a type of DataLine from which audio data can be read.

AudioFileFormat An instance of the AudioFileFormat class describes an audio file, including the file type, the file's length in bytes, the length in sample frames of the audio data contained in the file, and the format of the audio data.

AudioFileFormat.Type An instance of the Type class represents one of the standard types of audio file.

AudioFormat AudioFormat is the class that specifies a particular arrangement of data in a sound stream.

AudioFormat.Encoding The Encoding class names the specific type of data representation used for an audio stream.

AudioInputStream An audio input stream is an input stream with a specified audio format and length.

AudioPermission The AudioPermission class represents access rights to the audio system resources.

AudioSystem The AudioSystem class acts as the entry point to the sampled-audio system resources.

BooleanControl A BooleanControl provides the ability to switch between two possible settings that affect a line's audio.

BooleanControl.Type An instance of the BooleanControl.Type class identifies one kind of boolean control.

CompoundControl A CompoundControl, such as a graphic equalizer, provides control over two or more related properties, each of which is itself represented as a Control.

CompoundControl.Type An instance of the CompoundControl.Type inner class identifies one kind of compound control.

Control Lines often have a set of controls, such as gain and pan, that affect the audio signal passing through the line.

Control.Type An instance of the Type class represents the type of the control.

DataLine.Info Besides the class information inherited from its superclass, DataLine.Info provides additional information specific to data lines.

EnumControl A EnumControl provides control over a set of discrete possible values, each represented by an object.

EnumControl.Type An instance of the EnumControl.Type inner class identifies one kind of enumerated control.

FloatControl A FloatControl object provides control over a range of floating-point values.

FloatControl.Type An instance of the FloatControl.Type inner class identifies one kind of float control.

Line.Info A Line.Info object contains information about a line.

LineEvent The LineEvent class encapsulates information that a line sends its listeners whenever the line opens, closes, starts, or stops.

LineEvent.Type The LineEvent.Type inner class identifies what kind of event occurred on a line.

Mixer.Info The Mixer.Info class represents information about an audio mixer, including the product's name, version, and vendor, along with a textual description.

Port.Info The Port.Info class extends Line.Info with additional information specific to ports, including the port's name and whether it is a source or a target for its mixer.

ReverbType The ReverbType class provides methods for accessing various reverberation settings to be applied to an audio signal.


12.6.2 MIDI/nodebaseret musik (javax.sound.midi)

Denne pakke giver mulighed for læsning, skrivning, sequencing og syntese af MIDI-data (Musical Instrument Digital Interface).

ControllerEventListener The ControllerEventListener interface should be implemented by classes whose instances need to be notified when a Sequencer has processed a requested type of MIDI control-change event.

MetaEventListener The MetaEventListener interface should be implemented by classes whose instances need to be notified when a Sequencer has processed a MetaMessage.

MidiChannel A MidiChannel object represents a single MIDI channel.

MidiDevice MidiDevice is the base interface for all MIDI devices.

Receiver A Receiver receives MidiEvent objects and typically does something useful in response, such as interpreting them to generate sound or raw MIDI output.

Sequencer A hardware or software device that plays back a MIDI sequence is known as a sequencer.

Soundbank A Soundbank contains a set of Instruments that can be loaded into a Synthesizer.

Synthesizer A Synthesizer generates sound.

Transmitter A Transmitter sends MidiEvent objects to one or more Receivers.

Instrument An instrument is a sound-synthesis algorithm with certain parameter settings, usually designed to emulate a specific real-world musical instrument or to achieve a specific sort of sound effect.

MetaMessage A MetaMessage is a MidiMessage that is not meaningful to synthesizers, but that can be stored in a MIDI file and interpreted by a sequencer program.

MidiDevice.Info A MidiDevice.Info object contains assorted data about a MidiDevice, including its name, the company who created it, and descriptive text.

MidiEvent MIDI events contain a MIDI message and a corresponding time-stamp expressed in ticks, and can represent the MIDI event information stored in a MIDI file or a Sequence object.

MidiFileFormat A MidiFileFormat object encapsulates a MIDI file's type, as well as its length and timing information.

MidiMessage MidiMessage is the base class for MIDI messages.

MidiSystem The MidiSystem class provides access to the installed MIDI system resources, including devices such as synthesizers, sequencers, and MIDI input and output ports.

Patch A Patch object represents a location, on a MIDI synthesizer, into which a single instrument is stored (loaded).

Sequence A Sequence is a data structure containing musical information (often an entire song or composition) that can be played back by a Sequencer object.

Sequencer.SyncMode A SyncMode object represents one of the ways in which a MIDI sequencer's notion of time can be synchronized with a master or slave device.

ShortMessage A ShortMessage contains a MIDI message that has at most two data bytes following its status byte.

SoundbankResource A SoundbankResource represents any audio resource stored in a Soundbank.

SysexMessage A SysexMessage object represents a MIDI system exclusive message.

Track A MIDI track is an independent stream of MIDI events (time-stamped MIDI data) that can be stored along with other tracks in a standard MIDI file.

VoiceStatus A VoiceStatus object contains information about the current status of one of the voices produced by a Synthesizer.

12.7 Netværkskommunikation (java.net)

InetAddress This class represents an Internet Protocol (IP) address.

Socket This class implements client sockets (also called just "sockets").

ServerSocket This class implements server sockets.

SocketImpl The abstract class SocketImpl is a common superclass of all classes that actually implement sockets.

SocketImplFactory This interface defines a factory for socket implementations.

SocketOptions Interface of methods to get/set socket options.

SocketPermission This class represents access to a network via sockets.

DatagramSocket This class represents a socket for sending and receiving datagram packets.

DatagramSocketImpl Abstract datagram and multicast socket implementation base class.

DatagramSocketImplFactory This interface defines a factory for datagram socket implementations.

MulticastSocket The multicast datagram socket class is useful for sending and receiving IP multicast packets.

DatagramPacket This class represents a datagram packet.

URL Class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web.

URLClassLoader This class loader is used to load classes and resources from a search path of URLs referring to both JAR files and directories.

URLConnection The abstract class URLConnection is the superclass of all classes that represent a communications link between the application and a URL.

HttpURLConnection A URLConnection with support for HTTP-specific features.

JarURLConnection A URL Connection to a Java ARchive (JAR) file or an entry in a JAR file.

FileNameMap A simple interface which provides a mechanism to map between a file name and a MIME type string.

URLDecoder The class contains a utility method for converting from a MIME format called "x-www-form-urlencoded" to a String

URLEncoder The class contains a utility method for converting a String into a MIME format called "x-www-form-urlencoded" format.

URLStreamHandler The abstract class URLStreamHandler is the common superclass for all stream protocol handlers.

URLStreamHandlerFactory This interface defines a factory for URL stream protocol handlers.

ContentHandler The abstract class ContentHandler is the superclass of all classes that read an Object from a URLConnection.

ContentHandlerFactory This interface defines a factory for content handlers.

Authenticator The class Authenticator represents an object that knows how to obtain authentication for a network connection.

PasswordAuthentication The class PasswordAuthentication is a data holder that is used by Authenticator.

NetPermission This class is for various network permissions.

12.8 Databasekommunikation (java.sql)

Programmeringsgrænsefladen til databaser (JDBC). Se også kapitel 8.

Making a connection with a data source:

DriverManager The basic service for managing a set of JDBC drivers.
Driver The interface that every driver class must implement.

DriverPropertyInfo Driver properties for making a connection.

Connection A connection (session) with a specific database.

DatabaseMetaData Comprehensive information about the database as a whole.

SQLPermission The permission for which the SecurityManager will check when code that is running in an applet calls one of the setLogWriter methods.

Sending SQL statements to a database:

Statement The object used for executing a static SQL statement and obtaining the results produced by it.

PreparedStatement An object that represents a precompiled SQL statement.

CallableStatement The interface used to execute SQL stored procedures.

ResultSet A table of data representing a database result set, which is usually generated by executing a statement that queries the database.

ResultSetMetaData An object that can be used to get information about the types and properties of the columns in a ResultSet object.

Mapping an SQL value to the standard mapping in the Java programming language:

Array The mapping in the Java programming language for the SQL type ARRAY.

Blob The representation (mapping) in the JavaTM programming language of an SQL BLOB value.

Clob The mapping in the JavaTM programming language for the SQL CLOB type.

Date A thin wrapper around a millisecond value that allows JDBC to identify this as a SQL DATE.

Ref The mapping in the Java programming language of an SQL REF value, which is a reference to an SQL structured type value in the database.

Struct The standard mapping in the Java programming language for an SQL structured type.

Time A thin wrapper around java.util.Date that allows JDBC to identify this as a SQL TIME value.

Timestamp A thin wrapper around java.util.Date that allows the JDBC API to identify this as an SQL TIMESTAMP value.

Types The class that defines the constants that are used to identify generic SQL types, called JDBC types.

Custom mapping an SQL user-defined type to a class in the Java programming language:

SQLData The interface used for the custom mapping of SQL user-defined types.

SQLInput An input stream that contains a stream of values representing an instance of an SQL structured or distinct type.

SQLOutput The output stream for writing the attributes of a user-defined type back to the database.

12.9 Fjernkald af metoder (java.rmi)

RMI (Remote Method Invocation) er en måde at arbejde med objekter, der eksisterer i en anden Java virtuel maskine (ofte på en anden fysisk maskine), som om de var lokale objekter.

Remote The Remote interface serves to identify interfaces whose methods may be invoked from a non-local virtual machine.

Naming The Naming class provides methods for storing and obtaining references to remote objects in the remote object registry.

MarshalledObject A MarshalledObject contains a byte stream with the serialized representation of an object given to its constructor.

RMISecurityManager RMISecurityManager provides an example security manager for use by RMI applications that use downloaded code.

Pakken java.rmi.server

Denne pakke har klasser og interfaces til værtssiden af RMI.

RemoteObject The RemoteObject class implements the java.lang.Object behavior for remote objects.

RemoteServer The RemoteServer class is the common superclass to server implementations and provides the framework to support a wide range of remote reference semantics.

UnicastRemoteObject The UnicastRemoteObject class defines a non-replicated remote object whose references are valid only while the server process is alive.

RemoteStub The RemoteStub class is the common superclass to client stubs and provides the framework to support a wide range of remote reference semantics.

RemoteRef RemoteRef represents the handle for a remote object.

ServerRef A ServerRef represents the server-side handle for a remote object implementation.

Unreferenced A remote object implementation should implement the Unreferenced interface to receive notification when there are no more clients that reference that remote object.

RMISocketFactory An RMISocketFactory instance is used by the RMI runtime in order to obtain client and server sockets for RMI calls.

RMIClientSocketFactory An RMIClientSocketFactory instance is used by the RMI runtime in order to obtain client sockets for RMI calls.

RMIServerSocketFactory An RMIServerSocketFactory instance is used by the RMI runtime in order to obtain server sockets for RMI calls.

RMIFailureHandler An RMIFailureHandler can be registered via the RMISocketFactory.setFailureHandler call.

RMIClassLoader RMIClassLoader provides static methods for loading classes from a network location (one or more URLs) and obtaining the location from which an existing class can be loaded.

ObjID An ObjID is used to identify remote objects uniquely in a VM over time.

UID Abstraction for creating identifiers that are unique with respect to the the host on which it is generated.

Pakken java.rmi.activation

Denne pakke giver mulighed for objektaktivering (eng.: RMI Object Activation). Et fjernobjekts reference kan laves "persistent" og senere aktiveres til et "levende" objekt igen.

Pakken java.rmi.dgc

Denne pakke indeholder klasser til distribueret garbage-collection (DGC).

Pakken java.rmi.registry

Lille pakke med ekstra klasser til RMI's registreringsværktøj (rmiregistry).

Pakken javax.naming (navnetjenester og JNDI)

Pakker og klasser til Java Naming and Directory Interface (JNDI), der understøtter navneopslag og registrering i forskellige navnetjenester, bl.a. LDAP.

Pakken javax.rmi, javax.transaction og org.omg.CORBA (CORBA)

Pakker og klasser til CORBA (fjernkald af metoder på objekter, der er programmeret i andre programmeringssprog end Java, f.eks. C og C++) og RMI over IIOP (Internet Inter-Orb Protokollen).

12.10 Sikkerhed, kryptering, adgangskontrol (java.security)

Pakken java.security og dens underpakker understøtter en række systemer til checksum, kryptering, certifikater, digitale signaturer og nøgler, såsom SHA, MD2, MD5, DES, og RSA.

Med underpakkerne er der i alt omkring 100 klasser.

javabog.dk  |  << forrige  |  indhold  |  næste >>  |  programeksempler  |  om bogen
http://javabog.dk/ - af Jacob Nordfalk.
Licens og kopiering under Åben Dokumentlicens (ÅDL) hvor intet andet er nævnt (71% af værket).

Ønsker du at se de sidste 29% af dette værk (362838 tegn) skal du købe bogen. Så får du pæne figurer og layout, stikordsregister og en trykt bog med i købet.