Java Code Examples
Custom Components
-
CustomLabel
This class implements a label control by subclassing Canvas. On some
virtual machines, changing the color of labels doesn't work. Using
this class instead of Label does work.
-
Tiled Panel
This is a panel that draws a tiled image in its background.
Event Handling Examples
-
KeyEventPoster
This class contains static convenience methods simulate key strokes to
an arbitrary component. It requires Java 1.1 or later.
-
Tab Capturing Canvas
This is an example of a custom Component that can be tabbed into, but
not out of. It works by consuming key events for tab.
-
MainFrame
This is an example of a Frame that exits the application when it is
asked to close itself. Applications that want that behavior for their
main frame can define a subclass of this class.
Layout Managers
-
StackLayout
A simple layout that stacks components vertically, making each one as
wide as the widest component in the Container.
-
TreeLayout
This layout arranges Components in a tree-like organization and draws
lines between them.
Data Structures
-
Queue
A class that implements a Queue data structure.
Requires java 1.1 or later.
Internal Security
-
A Simple SecurityManager
Here is a simple example of how to write and use a
SecurityManager
to enforce a security policy.
Return to
Mark Grand's home page.