Previous lesson: 16.7 Modifying existing zookeeper detailsCourse contents Removing an existing zookeeper When you built the form for ZooKeeperPanel you included a Remove button. Before writing the code so that it removes the selected zookeeper (after asking for confirmation) you will change the status of the button so that it is only enabled ...
Previous lesson: 16.6 Updating ZooKeeperList automaticallyCourse contents Modifying existing zookeeper details Now that you have completed the code necessary to add new zookeepers you need to enable their details to be changed. What you will do is detect whenever the user selects one of the names in ZooKeeperList and pass that selected ZooKee...
Previous lesson: 16.5 The AdministratorFrame classCourse contents Updating ZooKeeperList automatically The ZooKeeperList object needs some way of being notified whenever a change to the collection of zookeeper objects held by the administrator changes, in order that it can update its model and thus be reflected in the list of items displayed....
Previous lesson: 16.4 The ZooKeeperPanel classCourse contents The AdministratorFrame class The frame now only needs to show ZooKeeperPanel inside a tab of a JTabbedPane. Create a class in virtualzoo.ui called AdministratorFrame: package virtualzoo.ui;import java.awt.*;import javax.swing.*;public class AdministratorFrame extends JFrame { publi...
Previous lesson: 16.3 Validating form inputCourse contents The ZooKeeperPanel class If you look at again at Figure 16.1 at the beginning of this section you will see that the two classes you have developed so far, ZooKeeperList and ZooKeeperEditor, are set as the left and right components inside a JSplitPane, underneath which is a panel containing ...
Previous lesson: 16.2 Defining a selection list of zookeepersCourse contents Validating form input In Section 7 you learned how Java exceptions can be used to indicate an error of some kind. You also learned that there are two types of exceptions, checked and unchecked: Use checked exceptions for errors from which you or the user can recoverUse unc...
Previous lesson: 16.1 Developing a user interfaceCourse contents Defining a selection list of zookeepers The left-hand section of the screen will show a scrollable list of all of the zoo keepers working at the zoo, and the natural component to use for this is a JList nested inside a JScrollPane. The JList class is a UI list-box component capable of...
Previous lesson 15.3 Modify the other core system classesCourse contents Developing a user interface Now that you have some familiarity with the various graphical components which are available you need to know how to get them to interact with each other to achieve your application's goals. In this section you will learn: How to go about developing...
Previous lesson: 15.1 Access modifiers and visibilityCourse contents Making ZooAdministrator a singleton class You have previously learned that to instantiate an object of any class you use the new keyword to invoke a class's constructor. For example, to instantiate some animals you may have done this: Animal leo = new Lion("Leo", Gender.MALE...
Previous lesson: 15.2 Making ZooAdministrator a singleton classCourse contents Modify the other core system classes Using the approach given above, it is the intention that the user interface classes only communicate with the core system through the ZooAdministrator class. At the moment there is nothing to prevent a user interface class ...