Page 843 - Introduction to Programming with Java: A Problem Solving Approach
P. 843

                getImage method, 185–86
getInsets method, 592 getInstance method, 329 getIntFromUser method, 564, 565 getMessage method, 572–73 getSelectedFile method, 629, 631 getSelectedIndex method, 727, 728 getSelectedItem method, 727, 728 getSource method, 671, 673
getText methods JButton, 663 JLabel, 652 JTextArea, 719 JTextField, 653
.gif files, 182, 686 Gigabytes, 5 Gigahertz, 4
GM, 8
Gosling, James, 252
goto reserved word, 752
Graceful failures, 130
Grade school division, 75 GradientPaint objects, 549–50 Graphical user interfaces (GUIs)
basic input/output implementations, 94–99
basic window component overview, 651–52
BorderLayout manager features, 698–704
class groupings for, 679–80
color controls, 185, 544, 549–50, 674–79 Hash table, 515
Histograms, 385–86
Home-appliance software, 14 Horizontal-gap arguments, 699, 704 Horton’s Law, 156
Hot swapping, 6
Hourly class, 530
HTML programs, calling applets from, 188 HTML tags, 613, 615, 701 HTMLGenerator program, 612–15
Human body, 473
Hyphens
as flag characters, 175
as subtraction operator, 11, 28 in UML diagrams, 216
I
i icons, 21, 95, 670 Icons
for information dialogs, 21, 95
JOptionPane dialog options, 670 Identifier naming rules, 64–65, 66 IdentifierChecker program, 166, 167 “if, else” form, 33, 109, 110
“if, else if” form, 33–34, 109, 110, 122–23 if statements
basic forms, 31–35, 109, 110
braces with, 302
conditional operator code versus, 449 equals methods in, 254, 255 overview, 108–11, 752
shortened, 227
for stopping conditions, 784 switch statements versus, 122–23 tic-tac-toe application, 712
CRC cards program, 331–35
design and layout manager overview,
694–96
displaying images and graphics, 182–88,
686
distinguishing multiple events, 671–74 embedded layout managers, 712–14 event-driven programming techniques,
646–47
FlowLayout manager features, 650,
696–98
GridLayout manager features, 704–7 implementing JLabel components,
652
implementing JTextField compo-
nents, 653–54
inner classes in, 658–62
JButton component overview, 662–67 JCheckBox components, 721–24 JComboBox components, 726–28 JFileChooser class implementation,
629–34
JFrame class features, 649
job application example, 728–34 JRadioButton components, 724–26 JTextArea components, 719–20, 721 line plots in, 584–92
listener implementation, 657–58 menus, scroll bars, and sliders, 734–38 message display in, 20–21
mouse listeners, 680–82, 683–85 overview, 645
polymorphism application, 544–50 string-based outputs, 161
Hashcode values, 514, 515 Headings
for API methods, 155, 156, 157 class, 60
for loops, 457–59
HTML, 613
main method, 60–61
return value types in, 220 Heavyweight components, 680 Height class, 264
HeightDriver class, 265
Hello World program, 16–20, 26 HelloGUI.java, 21 Hello.java, 16–20 HelloWithAFrame program, 668–70 Helper methods
implementing in top-down design, 317–18 of main method, 351–52
overview, 305–7, 308
Hexadecimal numbers
for ASCII characters, 746–47 for hashcode values, 514–15 overview, 460, 745
Hidden characters, 15–16 Hierarchies
assignment between classes, 522–24 combining approaches, 490–98 composition and aggregation, 472–79 exception class, 566
inheritance examples, 483–89 inheritance overview, 479–83 in Java API library, 755–56 polymorphism with, 524–30
High-level pseudocode, 47–48
Image files, 182, 686
ImageInfo program, 183 Immutability of string objects, 171 Implementation
of computer programs, 47, 48 defined, 9
of interfaces, 534
implements clauses, 534, 752 Implicit method calls, 515–16, 517 import statements
ArrayList class, 409 defined, 752
for JOptionPane class, 96 for Scanner class, 91
for subpackages, 679 wildcards in, 154–55, 329
Inaccessible objects, 252
Increment operator, 79, 443–45, 765 Indentation
with braces, 109, 300–301 coding conventions for, 763–64 with line breaks, 301
in pseudocode, 32
Index positions, 88, 169–70 Index variables
defined, 130
multiple, 458–59
in nested for loops, 134 scope of, 131, 216–17
Indexes (array)
basic principles, 372–73 for combo boxes, 728
tic-tac-toe application, 707–12
Unicode characters, 459–63 Graphics class, 182–88 Graphics2D class, 544, 546–47 GraphicsDemo applet, 185–86, 187 Graying out, 723
Green Project, 14
Greeting Anonymous program, 659–62 Greeting program, 654, 655–56, 660 GridLayout manager
limitations of, 707, 713, 729 overview, 704–7
tic-tac-toe application, 707–12
Grouping constructors, mutators, and acces- sors, 304–5
Growth, modeling, 227–34
Growth class, 229, 230
Guards, in UML class diagrams, 778
GUI components, 645, 681–82
GUI programs, 21. See also Graphical user
interfaces (GUIs) GUI windows, 95
H
Happy Birthday algorithm, 36–37, 38 Hard disks, 7
Hard-coded constants, 71, 72, 73–74 Hardware, 2–8
Harvard Mark II, 42
“Has-a” relationships, 473, 490 Hash marks, 584
Apago PDF Enhancer
Index 809
   841   842   843   844   845