Lightstreamer - Basic Stock-List Demo - Java SE (Swing) Client
This project contains an example of a Java Swing application that employs the Lightstreamer Java SE client library.
(download javase-stocklist-demo.zip; unzip it; launch
start_demo.bat on Windows or
start_demo.sh on Linux)
To run this demo, you must have Java installed . If you don't have Java already installed, please download it from [here] (https://www.java.com/en/download/).
This is a Java Swing version of the Stock-List Demos, where thirty items are subscribed to.
This app uses the Java SE Client API for Lightstreamer to handle the communications with Lightstreamer Server. A simple user interface is implemented to display the real-time data received from Lightstreamer Server.
You can sort on any columns and drag the columns around.
This application uses the LightstreamerClient class to connect to Lightstreamer Server and subscribe to the 30 items. The client library offers auto-reconnection and auto-resubscription logic out of the box. The status of the connection can be seen on the top left corener of the demo. Java Swing classes are used to display the real-time updates received from Lightstreamer Server. The application code implements a cell highlighting mechanism, too.
If you want to install a version of this demo pointing to your local Lightstreamer Server, follow these steps:
- Note that, as prerequisite, the Lightstreamer - Stock- List Demo - Java Adapter has to be deployed on your local Lightstreamer Server instance. Please check out that project and follow the installation instructions provided with it.
- Launch Lightstreamer Server.
- Download the
deploy.zipfile, which you can find in the latest deploy release of this project and extract its contents.
start_demo.baton Windows or
start_demo.shon Linux (please note that the demo tries to connect to http://localhost:8080).
To build your own version of
java_sld.jar, instead of using the one provided in the deploy.zip file from the Install section above, you have two options:
either use Maven (or other build tools) to take care of dependencies and building (recommended) or gather the necessary jars yourself and build it manually. For the sake of simplicity only the Maven case is detailed here.
The example requires that the QUOTE_ADAPTER has to be deployed in your local Lightstreamer server instance; the LiteralBasedProvider is also needed, but it is already provided by Lightstreamer server.
You can easily build and run this application using Maven through the pom.xml file located in the root folder of this project. As an alternative, you can use an alternative build tool (e.g. Gradle, Ivy, etc.) by converting the provided pom.xml file.
Assuming Maven is installed and available in your path you can build the demo by running
You can also run the application with the following command
mvn exec:java -Dexec.args="http://push.lightstreamer.com"
the arguments in the above command is obviously the target Lightstreamer server, it can be changed to point to your own server provided that Lightstreamer - Stock- List Demo - Java Adapter is installed on it (the LiteralBasedProvider is also needed, but it is already provided by Lightstreamer server.)
Lightstreamer Adapters Needed by This Demo Client
- Lightstreamer - Stock- List Demo - Java Adapter
- Lightstreamer - Reusable Metadata Adapters- Java Adapter
- Lightstreamer - Stock-List Demos - HTML Clients
- Lightstreamer - Basic Stock-List Demo - jQuery (jqGrid) Client
- Lightstreamer - Stock-List Demo - Dojo Toolkit Client
- Lightstreamer - Basic Stock-List Demo - .NET Client
- Lightstreamer - Stock-List Demos - Flex Clients
Lightstreamer Compatibility Notes
- Compatible with Lightstreamer Java Client API version 4.0 or newer.
- Ensure that Java SE Client API is supported by Lightstreamer Server license configuration.
- For a version of this example compatible with Lightstreamer Java Client API version 3.x, please refer to this tag.
- For a version of this example compatible with Lightstreamer Java Client API version 2.5.2, please refer to this tag.