Sams Teach Yourself Java™ in 24 Hours (Covering Java 7 and Android)
ptg7068951 212 HOUR 15:Responding to User Input The LottoEventclass has one constructor: LottoEvent(LottoMadness). The LottoMadn ...
ptg7068951 Completing a Graphical Application 213 you could use LottoMadnessfor lottery contests that generate a wider or smalle ...
ptg7068951 214 HOUR 15:Responding to User Input 21: JButton play= new JButton(“Play”); 22: JButton reset= new JButton(“Reset”); ...
ptg7068951 Completing a Graphical Application 215 73: row2.add(winners[i]); 74: } 75: add(row2); 76: 77: FlowLayout layout3 = ne ...
ptg7068951 216 HOUR 15:Responding to User Input After you add the shaded lines, you can run the application, which is capa- ble ...
ptg7068951 Workshop 217 Q&A Q. Do you need to do anything with the paint()method or repaint()to indicate that a text field h ...
ptg7068951 218 HOUR 15:Responding to User Input Quiz Why are action events called by that name? A. They occur in reaction to so ...
ptg7068951 WHAT YOU’LL LEARN IN THIS HOUR: .Scrolling components hori- zontally and vertically .Accepting a range of numeric inp ...
ptg7068951 220 HOUR 16:Building a Complex User Interface . JScrollPane(Component)—Create a scroll pane that contains the specifi ...
ptg7068951 Scroll Panes 221 22: JLabel subjectLabel = new JLabel(“Subject:”); 23: row2.add(subjectLabel); 24: JTextField subject ...
ptg7068951 222 HOUR 16:Building a Complex User Interface The text of an email is entered in a scrolling text area, which is impl ...
ptg7068951 Change Listeners 223 To create a vertical slider, use a constructor with an additional first argu- ment: the orientat ...
ptg7068951 224 HOUR 16:Building a Complex User Interface Change events occur throughout a slider’s movement. They begin when the ...
ptg7068951 Change Listeners 225 16: setVisible(true); 17: 18: canvas= new ColorPanel(); 19: red = new JSlider(0, 255, 255); 20: ...
ptg7068951 226 HOUR 16:Building a Complex User Interface 67: setVisible(true); 68: } 69: 70: public voidstateChanged(ChangeEvent ...
ptg7068951 Using Image Icons and Toolbars 227 When you run the application, as shown earlier in Figure 16.2, a frame contains th ...
ptg7068951 228 HOUR 16:Building a Complex User Interface Image icons often are used in toolbars, containers that group several c ...
ptg7068951 Using Image Icons and Toolbars 229 LISTING 16.3 The Full Text of Tool.java 1: importjava.awt.; 2: importjava.awt.even ...
ptg7068951 230 HOUR 16:Building a Complex User Interface The Toolapplication requires three graphics files that are used to crea ...
ptg7068951 Summary 231 Summary This is the last of four hours devoted to Swing, the part of the Java lan- guage that supports GU ...
«
7
8
9
10
11
12
13
14
15
16
»
Free download pdf