Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Applet Coding11/16/2009Opening Discussion●What did we talk about last class?●Minute Essay comments–Getting the serialVersionUID.–Could we make a “reverse paint” where we draw and it prints the code that would make that drawing?–Do you have to use Eclipse for the second project?Comparing Applets to Greenfoot●Technically applets give us a lot more flexibility than the standard Greenfoot program, but we aren't using most of that.●For us the main difference is that Greenfoot kept track of things for us and helped do certain things that now we need to do ourselves.Applet Objective●I'd like for to write an “infinite notepad”. This will hit on many of the concepts we need to do other things.●You can type in lines of text that will appear near the middle of the screen.●Mouse drags will scroll around the view so you can see different strings.What We Need●Each string we enter needs the String along with an x and y position. We should create a separate class for those.●We will want a list of them to hold all the text that has been typed.●We need to keep integers for where we are currently looking.Listening for Events●One of the things that we have to do if we want to handle mouse of keyboard information in an applet (or a real Java application) is to listen for events.●In this case all the events effect the applet as a whole so we can just make the applet implement the different event listeners.●We will add those listeners in with a few lines of code in the init method because it needs to happen right at the beginning.Code●The logic for this program is mostly split between the listener methods and the paint method.Minute Essay●What questions do you have about what we did
View Full Document