Java 7 for Absolute Beginners

(nextflipdebug5) #1

CHAPTER 7 ■ WRITING A USER INTERFACE



  • The normal idiom for working with Swing components is to create a component,
    set whatever attributes we need to set on it (to customize it for our purpose), and
    then add that component to another component.

  • It can be handy to move the mouse and menu listeners (and keyboard listeners, if
    we needed them) out to their own classes, to simplify a large class and to let each
    class focus on a single, clear purpose.

  • It can be handy to have a helper class, to again simplify a large class.

  • All the members of a class can be static and how to use such a class.


The best way (and only real way, in my opinion) to learn to program is to program. So go write a
Swing application or two of your own.
Free download pdf