Before we get to the system application, let’s consider our options for displaying content on our rack. A common approach to displaying content
is to use a web browser. It’s a rich display engine for a broad range of content, including device user interfaces. KOS has sophisticated browser
integration support, including the ability to control multiple browsers across multiple devices, push real time data, handle asynchronous operations
and even provides the ability for different browsers to communicate directly to each other. However, for our first example we want to focus on
the basics such as learning how to use KOS Studio and debugger integration, so we’re going to display content in the simplest way possible,
which is using Java Swing to rotate through images using a timer.
The class below uses basic Swing components to fill the screen with a Jframe that switches between images using a timer. As this is standard
Swing programming, we show the class below without any
additional description. This class will be used in our system application to display content.
Creating a system application for KOS is as simple as extending the SystemApplication class as shown below:
/**
* (C) Copyright 2024, TCCC, All rights reserved.
*/
package com.bookstore.rack;
import javax.swing.SwingUtilities;
import com.tccc.kos.core.service.app.BaseAppConfig;
import com.tccc.kos.core.service.app.SystemApplication;
/**
* System application for simple digital rack that has a display that
* rotates content.
*
* @author David Vogt (david@kondra.com)
* @version 2024-09-17
*/
public class RackApp extends SystemApplication<BaseAppConfig> {
@Override
public void started() throws Exception {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new RackUI().setVisible(true);
}
});
}
}