Explanation

The StudentForm class

The StudentForm class extends the JInternalFrame class. A JInternalFrame object provides many of the features of a native frame, including dragging, closing, becoming an icon, resizing, title display, and support for a menu bar. Generally, a JInternalFrame is added to a JDesktopPane. The constructor calls the setup method to create the necessary components. The setup() method is used to create a number of components and to get a remote reference.

The ButtonHandler Class

The ButtonHandler class implements the ActionListener interface. This class is an inner class used to handle action events generated by buttons. When a user presses a button, the actionPerformed() method is invoked. This method gets the object on which the event occurred and calls the appropriate method.

The add() method

The add() method is invoked when the user presses the "add" button. This method calls the remote addRecord() method to add a new record. Finally, the result returned by the server is displayed in a dialog box.

The update() method

The update() method is invoked when the user presses the "update" button. This method calls the remote updateRecord() method to modify a record. Finally, the result returned by the server is displayed in a dialog box.

The delete() method

The delete() method is invoked when the user presses the "delete" button. This method calls the remote deleteRecord() method to delete a student record.

The clear() method

The clear() method is invoked when the user presses the "clear" button. This method clears the text in text fields.

The find() method

The find() method is invoked when the user presses the "find" button. This method calls the remote findRecord() method to find a record. If a record is found, it is displayed.

The check() method

The check() method checks whether the form is properly filled or not. The method returns a boolean value.

The fill() method

The fill() method is used to fill data in the text boxes. The method takes a Student object as its arguments.

The showMessageDialog() method

The showMessageDialog() method is used to show a message dialog box with the specified message.

The source code for this example is over. In the next chapter, we will create a DSN before running this program.

 

 

 

 

RMI BOOK MAIN PAGE                Top

  
Copyright © 2001 www.universalteacher.com