Java Reference
In-Depth Information
Introduction
The way in which a user enters data and instructions into a computer and
receives feedback from the computer is called a user interface . As discussed
in Chapter 1, the Java platform allows you to create programs and program
components that have many different user interfaces. In a Java console applica-
tion, for example, the user interface is a command-line interface that displays
character input and output on a black screen. A windowed application, by con-
trast, has a graphical user interface that is displayed in a window. Another type
of Java program, an applet, can use a graphical user interface to display output
to a user in a browser window.
In this chapter, you will learn how to use TextPad to write, compile, and
execute a stand-alone Java program that runs as a console application. Even
though communicating with a computer using a command-line interface may
seem tedious when compared with today's highly interactive GUI applications,
using commands to interact with a computer is a common, easy place to start.
Many networking and server applications, for example, use console applications
written in Java; console applications also are useful for testing and system config-
uration. Next you will learn how to create an applet using TextPad. The applets
will run and display in the Applet Viewer window, which is the mini-browser
supplied with the Java SDK.
In this chapter, you will learn the basic parts of a Java program as well as the
use of proper Java syntax, which is the set of grammar or rules that specifies the
spelling of its commands and any required symbols. You will learn to analyze a
problem and design a solution. You then will learn how to create a console
application, compile and test the application, and run the program. Finally you
will learn how to create an applet and its HTML hosting file. The applet will dis-
play text and a graphic in Java's Applet Viewer window.
Chapter Two — The Welcome to My Day Program
The console application developed in this chapter is the Welcome to My Day
program, which displays a welcome message, the user's name, and the system
date on a splash screen (Figure 2-1a). A splash screen is a screen that is dis-
played before the main program is displayed. The compiled Java source code
will cause text output to display on the screen for the user to read. Creating this
console application serves as a first step in creating an electronic calendar appli-
cation for either a desktop or a handheld computer system.
The same electronic calendar application also will need to be accessible to
users via the Web. To create a splash screen for the Web-based version of the cal-
endar application, the console application must be converted to an applet that
displays text output and a graphic in the Applet Viewer window (Figure 2-1b).
As shown in Figures 2-1a and 2-1b, the console application displays white letters
on a black screen, while the applet displays black letters on a light blue (cyan)
background, beside the graphic. Both the console application and the applet will
become part of the electronic calendar application when it is fully implemented.
Search WWH ::




Custom Search