Java: Example - Scribble
This page discusses - Java: Example - Scribble.
Java: Example - Drawing a Face - v5 - Fill-in
This page discusses - Java: Example - Drawing a Face - v5 - Fill-in.
Java: Example - Drawing a Face - v5
This page discusses - Java: Example - Drawing a Face - v5.
Java: Example - Drawing a Face - v3
This page discusses - Java: Example - Drawing a Face - v3.
Java: Example - Drawing a Face - v2
This page discusses - Java: Example - Drawing a Face - v2.
Java: Example - Drawing a Face
This simple application creates a graphic component to display a face. It uses a JPanel and overrides the paintComponent method to do the drawing.
Java: Example - Simple Calculator
This page discusses - Java: Example - Simple Calculator.
Example - Raise.java
This program program was inspired by a Gore-Bush ballots in Florida. The paintComponent method looks too complicated and could be improved. Also, there's no need to redraw all the fixed elements; these could be drawn only once and saved in a BufferedImage.
Java: Example - ToUppercase
Java: Example - ToUppercase.
Java: Example - ColorDisplay
Java: Example - ColorDisplay.
Java: Example - Sleepy Source
This program combines components (eg, buttons) and drawing. The Sleeper panel is used for graphics..
Java: Example - Buffered Analog Clock
The following is an analog (uses hands) clock that uses buffered drawing to increase speed..
Java: Example - BullseyeDemo
Java: Example - Rolling Dice
This simple program rolls two dice..
Drawing a Face - v4
Instance variables representing the state.
This program reads in a bunch of images (cards) and allows them to be dragged around the screen..
This is a simple text clock..
Text Clock 2
This is the same as Example - Text Clock, but defines a reusable component for the clock..
Convert to Roman Numerals
The following example program converts from decimal input to roman numerals..
The Slide Puzzle program displays a grid of tiles that must be arranged in ascending order..
Two players alternate making moves. The player who places five pieces in a row wins..
This simple paint program leaves much to be desired..
Drag the ball around on the applet to the left..
This is a simple demonstration of listening to mouse events on a panel..
Extend Text Clock
Here are several possible extensions to Example - Text Clock 2..
This program does a simple animation..
Drawing a Face v2
This simple application creates a graphic component to display a face..
A program which converts feet and inches to centimeters.
Write a program which converts feet and inches to centimeters..
Inches To Cm
The following program converts feet and inches to centimeters..
This simple text editor uses a JTextArea with Actions to implement the menu items..
The following program has two text fields, one for a first name and one for a last name. When the button is pressed, it formats them in the result field in the standard last name comma first name style..
Example - Calc Extensions
The calculator example program uses integers..
Example - Calc GUI
This is the source for the graphical user interface of a simple calculator..
Example - Simple Calculator
Here is the source for the simple calculator shown..
Body Mass Index (BMI)
The Body Mass Index program is divided into two files, the main program is in one file, and the GUI and logic are in another..
This file defines an applet.
This template is a reasonable way to start an applet, where GenericPanel is a subclass of JPanel and it contains the code to build a GUI with the appropriate listeners..
This file defines a class with a main method.
This template is a reasonable way to start an application, where GenericGUI is a subclass of JPanel which contains the code to build a GUI with the appropriate listeners..
This program converts miles into kilometers..
Here we define a subclass of JFrame (a window) that constructs a JPanel to put the one component on. In this case the component is a button that does nothing..
This is about the simplest GUI (Graphical User Interface) window that you can make. The window is very small, and will appear in the top left corner of the screen..
Separating UI from Logic
One of the most important ideas in organizing programs is to separate the user interface from the logic ..
This series of progressive examples shows a typical pattern for building simple applications with a window.
Example - First Window shows a main program that creates an empty window (JFrame)..