The following UML diagram identifies the classes used in the Image Viewer example:
The ImageViewer example consists of the following classes:
ImageViewerMIDlet
This is the starting point of the application. It controls the display and handles the transitions between the different screens.
FileSelector
The class contains the bulk of the application. It contains the user
interface and navigates the device's file system. It also contains support
for file-oriented operations such as delete, rename, and directory creation. FileSelector
will
check whether the fileconn.dir.photos
system property
is available and will start navigating the file system on that directory if
available. Otherwise, it will display a list of all the available roots.
ImageCanvas
The class displays a selected image on the screen and upon detecting
a key being pressed returns to the FileSelector
.
OperationsQueue
One important consideration when designing the Image Viewer MIDlet is
that I/O operations are to be executed in a separate thread. The OperationsQueue
class
accomplishes this by executing commands serially in a separate thread.
Operation
The class defines the Operation
interface used
by OperationsQueue
.
InputScreen
The class InputScreen
is a simple form used to
prompt the user to enter some text. This is used when creating a new directory
or when renaming a file.
ErrorScreen
ErrorScreen
is a simple class used for reporting
errors to the end user.
The GUI consists of a simple file browser displaying the current directories and allowing navigation up and down the directory tree. The figures below show two screenshots of the file browser.
Once an image is selected, it is displayed on a simple canvas with a black background as shown in the figure below.