28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 10 ■ Directing the Cast of Actors: Creating a Casting Director Engine and Creating the Bagel Actor Class<br />

Figure 10-10. Mouse-over the yellow light bulb icon in the line number area of the pane and reveal the constructor tip<br />

For the first final keyword that you click on, and Alt-Enter, and have NetBeans write your CastingDirector()<br />

constructor method for, it will code the public CastingDirector(){...} structure for you, and add the first instantiation<br />

statement. As you can see in Figure 10-11, once you click on each of the three final keywords at the top of your class<br />

and use the same work process, you can have NetBeans write the entire constructor method for you. The <strong>Java</strong> code<br />

that NetBeans generates uses the <strong>Java</strong> this keyword (so that the CastingDirector object can refer to itself) to preface<br />

each of the three data store objects, as well as using the <strong>Java</strong> new keyword to create new instances of ArrayList and<br />

HashSet should look like the following:<br />

public CastingDirector() {<br />

this.CURRENT_CAST = new ArrayList();<br />

this.COLLIDE_CHECKLIST = new ArrayList();<br />

this.REMOVED_ACTORS = new HashSet();<br />

}<br />

222<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!