Tutorial: Building an Rogue Wave Server Application > Implementing a Java Component > Building a Client with JavaBeans > Initializing and Running the Component
 
Initializing and Running the Component
To do so, you are going to add the code lines in bold typeface to the generated source code.
import javax.swing.*;
import ilog.server.jcomp.*;
import ilog.server.jsds.*;
import ilog.server.jsds.swing.*;
import java.awt.*;
 
public class MyFrame extends IlsDSJFrame {
IlsDSJTable ilsDSJTable = new IlsDSJTable();
 
public MyFrame() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
 
public static void main(String[] args) {
IlsDSComponent.Initialize(args);
 
MyFrame myFrame = new MyFrame();
 
myFrame.setSize(512, 384);
myFrame.setVisible(true);
}
 
private void jbInit() throws Exception {
ilsDSJTable.setDataSourceContainer(this);
ilsDSJTable.setServerName("network7");
ilsDSJTable.setObjectId("Domain_1");
ilsDSJTable.setViewId("DomainView");
ilsDSJTable.setLabel("table");
this.getContentPane().add(ilsDSJTable, BorderLayout.CENTER);
 
ilsDSJTable.connect();
}
}
6. Initialize the Java data source library with the following code line:
IlsDSComponent.Initialize(args);
This instruction initializes the various parts of the library and processes the command line:
*first, the “Java data source part” (IlsDSComponent),
*Then, the “Java component” part (MvComponent), if necessary,
*and, finally, the communication layer (MvTCP by default).
You can set another communication layer by specifying the appropriate arguments on the command line.
7. Connect it to the server to open the designated view:
ilsDSJTable.connect();
The source code of your Java application now looks like this:
Figure 9.3    Application Source Code
Your Java client is now ready to run. You can use the compiled server from demo network7, for example. See the README files of the demo for more information on how to compile and run the server with the view you have defined in this tutorial.
8. Then simply run our Java application:
java MyFrame
You should see the following window, which shows a table view of server object Domain_1,from the Network example:
Figure 9.4    Table View of Network Server Object Domain_1

Version 5.7
Copyright © 2013, Rogue Wave Software, Inc. All Rights Reserved.