KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > thinlet > drafts > Lists


1 package thinlet.drafts;
2
3 import thinlet.*;
4
5 public class Lists {
6     
7     public void listSelectionChanged(Thinlet thinlet, Object JavaDoc list, Object JavaDoc button) {
8         thinlet.setBoolean(button, "enabled", thinlet.getSelectedIndex(list) != -1);
9     }
10     
11     public void moveListItem(Thinlet thinlet, Object JavaDoc sourcelist, Object JavaDoc targetlist) {
12         Object JavaDoc[] items = thinlet.getSelectedItems(sourcelist);
13         for (int i = 0; i < items.length; i++) {
14             thinlet.remove(items[i]);
15             thinlet.add(targetlist, items[i]);
16         }
17     }
18     
19     public void addTableRows(Thinlet thinlet, Object JavaDoc table) {
20         for (int i = 1; i <= 30 ; i++) {
21             Object JavaDoc row = Thinlet.create("row");
22             for (int j = 1; j <= 3; j++) {
23                 Object JavaDoc cell = Thinlet.create("cell");
24                 thinlet.setString(cell, "text", "Cell-" + i + "-" + j);
25                 thinlet.add(row, cell);
26             }
27             thinlet.add(table, row);
28         }
29     }
30     public void clearTable(Thinlet thinlet, Object JavaDoc table) {
31         thinlet.removeAll(table);
32     }
33 }
Popular Tags