Java Reference
In-Depth Information
77
78 private static final int FRAME_WIDTH = 400 ;
79 private static final int FRAME_HEIGHT = 250 ;
80
81 private static final int AREA_ROWS = 10 ;
82 private static final int AREA_COLUMNS = 30 ;
83
84 private static final double DEFAULT_RATE =
5 ;
85 private static final double INITIAL_BALANCE
= 1000 ;
86 }
485
486
S ELF C HECK
22. What is the difference between a text field and a text area?
23. Why did the InvestmentFrame program call
resultArea.setEditable(false) ?
24. How would you modify the InvestmentFrame program if you didn't
want to use scroll bars?
H OW T O 10.1: Implementing a Graphical User
Interface (GUI)
A GUI program allows users to supply inputs and specify actions. The
InvestmentViewer3 program has only one input and one action. More
sophisticated programs have more interesting user interactions, but the basic
principles are the same.
Step 1 Enumerate the actions that your program needs to carry out.
For example, the investment viewer has a single action, to add interest. Other
programs may have different actions, perhaps for making deposits, inserting coins,
and so on.
Step 2 For each action, enumerate the inputs that you need.
Search WWH ::




Custom Search