Như bạn có thể nhìn thấy từ các ý kiến javadoc, trước tiên chúng ta kiểm tra xem các hình ảnh nền là null. Nếu đó là không, chúng tôi tạo ra một chiều hướng mới với chiều rộng và chiều cao của đối tượng đối tượng hình ảnh nền. | Implementing the Controller Gets the size the controller should be to look its best @return the dimensions the controller renders its self the best. Public Dimension getPreferredSize If the current image is not null then return the size of the image. If it is null defer to the super class. Insert Controller getPreferredSize if image null return new Dimension frame frame return As you can see from the JavaDoc comments we first check to see if the background image is null. If it is not we create a new dimension object with the width and height of the background image object. If the image is null we return the preferred size of our parent object. Back to top Summary That completes this file. We have built a controller that contains a dumb Container responsible for the layout of the three-image button controls. We created an inner class to handle action events and registered ourselves as a listener of the image buttons. We created some action routines to allow clients of the controller SlideShow to register with the Controller class for ActionEvents. Finally we rounded out our class by adding a paint method and getPreferredSize . Next we will examine the file SlideShowjava. Return to the main tutorial file for preparatory instructions by clicking here. Implementing the Slide Show Í ADC Apple Developer Connection Membership Technical Business L Search Technical Java Building the Slide Show File Contents Implementing the Slide Show Overview 1 Declaring and Defining Constants 2 Declaring the Slide Show Data Members 3 Declaring our Application Menus 4 Creating the main entry point for the application 5 Initializing the SlideShow s State 6 Setting up and Initializing our Application Controls 7 Initializing the Application Menus 8 Registering our Application Event Listeners 9 Implementing the Application Thread Model 10 Implementing togglePlaying 11 Implementing the oneStep Method 12 Implementing the .