Java Reference
In-Depth Information
NOTE
Although there isn't a method to detect double-clicks on the mouse button,
it's easy to implement. The
getClickCount()
method for the
MouseEvent
object
thatispassedtothe
mouseClicked()
methodreturnstheclick count.Torespondto
a double-click, you could write the following in the
mouseClicked()
implementa-
tion:
if(e.getClickCount() == 2) {
//Response to double-click...
}
A FONT SELECTION DIALOG
You don't really want to be stuck with a 12-point serif font. You need to be able to release your creativity
with all kinds of fonts and sizes so your sketches astound and delight! A font dialog that pops up in response
to a click on a suitable menu item could enable you to change the font for text elements to any of those
available on the system. Implementing this gives you a chance to see how you can get at and process the
fonts that are available. You also learn more about how to add components to a dialog window. The first step
is to establish what the font dialog does.