Java Reference
In-Depth Information
In line 28 of Listing 13.5, a DownloadService object is obtained and is then queried in order to
discover the modules (implemented as JNLP parts ) that are currently cached locally (line 31 of
Listing 13.5).
L ISTING 13.5 The AboutTable class.
package com.marinilli.b2.c13.util;
import javax.swing.*;
import javax.jnlp.*;
import javax.swing.table.*;
import java.util.*;
import com.marinilli.b2.ad.util.*;
/**
* Chapter 13 - utility component to be shown in the about dialog
*
* @author Mauro Marinilli
* @version 1.0
*/
public class AboutTable extends JTable {
13
/**
* constructor - creates the table model and populates it
*/
public AboutTable(String[] parts, String[] desc) {
Vector data = new Vector();
Vector columnNames = new Vector(2);
columnNames.add(“name”);
columnNames.add(“description”);
setRowSelectionAllowed(true);
setColumnSelectionAllowed(false);
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
DownloadService ds =
(DownloadService)GeneralUtilities.getService(“javax.jnlp.DownloadService”);
for (int i = 0; i < parts.length; i++) {
Vector row = new Vector();
if (ds.isPartCached(parts[i])) {
row.add(parts[i]);
row.add(desc[i]);
data.add(row);
}
}
setSelectionBackground(java.awt.Color.pink);
setBackground(java.awt.Color.orange);
Search WWH ::




Custom Search