Using JavaFX Storage APIs
StickyNote is a simple JavaFX application that user can use as sticky note similar to Stickies.
Information about user's to do list is stored locally on client's using JavaFX Storage and Resource APIs. When the application starts next time, information is picked up and displayed again using same APIs.
The main class takes care of storing data once the user clicks on Add symbol (+) image or return key in textbox. The same class also takes care of clearing the data in store when user clicks on Trash image. ImageButton class is to create more sophisticated image based buttons for add and clear functionality.
The following lines of code demonstrates use of Storage APIs to create a storage entry:
storage = Storage { source: "stickynote" };The same line of code serves the dual purpose. If the storage entry with this name doesn't exist, it will be created, and if the storage entry already exists, storage variable will pick up the already existing entry
Once the storage entry is created, it can be viewed using Resource API. This has been done in this example by declaring variable res in the following line of code
res = storage.resource;Further reading and processing of data has been done using other common APIs.
The last part of code makes a call to clear api which will clear the associated storage
