Using Platform APIs

In the previous chapter, we looked at how the Java platform has been modularized, what the modules look like and how to navigate and find more information about them. In this chapter, we'll get hands-on and implement and extend functionality in the address book viewer application by using some of the platform APIs. In the process, I'll walk you through the typical process of finding and using platform APIs, as well as how to organize application modules to have better reusability and modularity.

Here are the enhancements we'll make to the address book viewer application in this chapter:

  • We'll add logging logic to the application using the Java Logging APIs. This is not really a user-facing feature, but it's handy as a developer to be able to log informational and error messages from your application.
  • We'll use XML APIs to read contact information from an XML file. The application currently has a bunch of hardcoded users. We'd like to update that to read from an XML file on a path that's provided by the user.
  • We'll add a graphical user interface to the application by displaying a list of names. Clicking on a name in the list then displays detailed contact information of that contact. We'll be building this using the Java FX APIs.

All of the preceding features requires the usage of Java platform APIs. By achieving the preceding three objectives, you will have had good practice in establishing dependencies on and using the Java platform modules. Note that the focus in this chapter is on using the platform APIs and not on learning about the specific APIs themselves. So, even though you don't plan to use or learn about the Java XML APIs or the Java FX APIs, I still recommend you open your editor and follow through the steps covered in this chapter hands-on. Using these specific APIs in this chapter is just a means to learning about using platform APIs in general. Once you are done working on this chapter, you'll be in a much better position to browse and use other Java Platform APIs too.

We have a lot to cover, so let's get started!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.171.212