JSON-JAVA / NOTES</>↗JSON-Java06 Feb 2022
A JSONObject is an unordered collection of key-value pairs. To read values from the JSONObject we can use the get(String key) and opt(String key) methods. These generic methods return an Object, which you can cast to a certain type. There are also typed get and opt methods to read value in specific type such as […]
JSON-JAVA / NOTES</>↗JSON-Java05 Feb 2022
To convert Java objects or POJOs (Plain Old Java Objects) to JSON we can use one of JSONObject constructor that takes an object as its argument. In the following example we will convert Student POJO into JSON string. Student class must provide the getter methods, JSONObject creates JSON string by calling these methods. In this […]
JSON-JAVA / NOTES</>↗JSON-Java05 Feb 2022
In the previous example we use JSONObject to directly put key-value pairs to create JSON string, using the various put() methods. Instead of doing that, we can also create JSON from a Map object. We create a Map with some key-value pairs in it, and pass it as an argument when instantiating a JSONObject. These […]
SWING / NOTES</>↗Swing13 Jan 2022
Filter items in a long list are often accomplished using the JTextField component. As the user inputs into the JTextField component, the set of items shown in the list is narrowed to just those things that correspond to the input received from the user. It is necessary to utilize two elements to implement this function […]
JSCH / NOTES</>↗JSch04 Jan 2022
To connect to an SSH server using JSch (Java Secure Channel), you need to perform the following steps: Steps to Connect to SSH Server Using JSch Add the JSch library to your project dependencies. If using Maven, add the following dependency: <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> <version>0.1.55</version> </dependency> If not using a dependency manager, download jsch.jar and […]
E-ICEBLUE SPIRE / NOTES</>↗E-iceblue Spire16 Jun 2021
The following example will show you how to use the E-iceblue‘s free Spire.Doc for Java to perform mail merge operations on MS Word documents. Create Maven Project and Add Dependencies Create a maven project and add the following dependencies and repositories in your project’s pom.xml file. <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/P...