Java Programming with JavaTools

The task of learning a foreign language can be broken down into at least two parts: mastering the grammatical structure of the new language and acquiring sufficient vocabulary. The task of learning Java or any other programming language involves similar steps. In the case of a programming language, the "vocabulary" lesson involves learning the set of primitive commands you can issue to the computer. These typically include commands telling the computer to do things like "display the number 47.2 on the screen" or "store the name typed on the keyboard in your memory." The grammatical structures of a computer language enable you to form phrases that instruct the computer to perform several primitive commands in sequence or to choose among several primitive commands based on a user input.

When learning a new human language, one intertwines the processes of learning vocabulary and grammar. The alternatives would just be silly. The same applies to learning a programming language. So, throughout the course we will alternate between introducing new examples of the primitive commands available in Java and new elements of the grammatical structures used to compose complex programs out of these primitives.

We will begin by introducing a few Java commands used to instruct the computer to display geometrical objects (rectangles, lines and circles) on the screen. Then, working with this little bit of vocabulary, we will teach you enough grammar to instruct the computer to carry out these primitive operations in response to the actions a user performs with the mouse.

A major feature of a programming language is that the vocabulary used can be expanded by the programmer. In particular, the programmer needs to associate names with the pieces of data processed by the program. As an example, suppose you want to draw a line that ends at the current position of the mouse. The numeric coordinates of this point will not be determined until the program you write is used. So, when you write the program, you cannot include the numeric coordinates. Instead, you must introduce a name that can be used as a place holder for the information that will not become available until the program is run. The introduction of such name enables you to expand the vocabulary used as you program.

  • Displaying Simple Graphics
  • Simple Responsive Programs
  • Methods for Handling Events
  • Naming and Modifying Objects
  • Non-graphical Classes of Objects
  • Summary of Available Graphical Objects and Methods
  • Interface Components
  • Footnotes