Skip to Main Content
Java 6 Illuminated: An Active Learning Approach, 2nd Edition
book

Java 6 Illuminated: An Active Learning Approach, 2nd Edition

by Julie Anderson, Herve J. Franceschi
February 2008
Intermediate to advanced content levelIntermediate to advanced
1288 pages
39h 39m
English
Jones & Bartlett Learning
Content preview from Java 6 Illuminated: An Active Learning Approach, 2nd Edition
878 CHAPTER 12 Graphical User Interfaces
108 }
109 // else Close ... , do not draw
110 }
111 }
EXAMPLE 12.12 The SubHunt Class
Example 12.13 shows the GUI client class that enables a user to play the
submarine hunting game.
In this game, the only mouse action we care about is a click; therefore, we
are interested in only one method of the MouseListener interface:
mouseClicked. To simplify our code, we can extend the MouseAdapter class,
which provides implementations for the five MouseListener methods, so
our event handler needs to override only the mouseClicked method.
At lines 1116, we declare our instance variables. The ints x and y represent
the x
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

JFC Swing Tutorial, The: A Guide to Constructing GUIs, Second Edition

JFC Swing Tutorial, The: A Guide to Constructing GUIs, Second Edition

Kathy Walrath, Mary Campione, Alison Huml, Sharon Zakhour
Java Illuminated, 4th Edition

Java Illuminated, 4th Edition

Julie Anderson, Hervé J. Franceschi

Publisher Resources

ISBN: 9780763749637