1GUIs, Events, and Listeners11/28/20072Opening Discussion■Let's look at solutions to the interclass problem.■Do you have any questions about the project? The project description now gives the details of what you need to give me for the design.3Nesting Layouts■We saw last time that the proper way to position components in GUIs in Java is with Layout Managers. There are some powerful and complex layouts that you can use, but most GUIs can be achieved by nesting simple layouts.■We do this by putting a container object in the proper location in one layout and giving it the layout that we want. In Swing the container that we generally use is a JPanel.4Interacting with GUIs■User interaction with GUIs is very different from the interaction with a text program.■There a multiple things that you can interact with. (buttons, text fields, check boxes, etc.)■The program should just stop waiting for you to interact with something.5Events and Listeners■Alice had events for taking certain user inputs. Java has the same, but as you would guess, we implement them differently.■Different GUI elements have different events that can happen to them.■We register Listeners with GUI elements so that when an event happens, code in the Listener will be called.■Different types of events have different types of listeners. We write subclasses of the listener interfaces that do what we want.6Code■Let's give our programs interactivity. At the very least we should make it so that we can click a button to make something happen.■Many of you might find a JTable useful so let's write a little code that uses one of those as well.7Minute Essay■What parts of building and using a GUI don't make sense to you right now?■The last quiz is at the beginning of next class.■Interclass Problem – Do problem
View Full Document