KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > helloworld > listeners > HelloWorldTableAdd_li


1 /*******************************************************************************
2  * Copyright (c) 2004, Dirk von der Weiden.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * Dirk von der Weiden - initial API and implementation
10  *
11  * Created on 26.02.2005
12  *
13  * date: 26.02.2005
14  * project: WiSer-HelloWorld
15  *
16  * *******************************************************************************/

17
18 package helloworld.listeners;
19
20 import Jmc.baseGui.base_guiListener;
21 import Jmc.commonGui.*;
22 import Jmc.commonGui.loader.*;
23 import Jmc.baseTools.*;
24 import Jmc.baseGui.*;
25
26 import javax.swing.table.*;
27
28 /**
29  * @author Dirk
30  *
31  * date: 13.02.2005
32  *
33  * <p>
34  * Purpose: The listener adds a row to the table.
35  * </p>
36  */

37 public class HelloWorldTableAdd_li implements base_guiListener
38 {
39   /**
40      * <p>
41      * Is called by the framework whenever an event has been fired by the corresponding widget
42      * </p><p>
43      *
44      * </p><p>
45      * @param Widget which generated the event
46      * </p>
47      */

48   public void pcmf_execListener(base_guiObj xParam) throws Exception JavaDoc
49   {
50     Object JavaDoc l_row1[] = {"new 1", "new 2", "new 3", "new 4"};
51
52     // get all relevant widgets from the registry
53
base_table_if l_table=(base_table_if) base_registredObject.pcmf_getObjByName("atable");
54     base_tableLoader l_load = (base_tableLoader)base_registredObject.pcmf_getObjByName("tableLoader");
55   
56     if (l_table.pcmf_getValue() == null)
57       return;
58     
59     // insert row
60
((DefaultTableModel)l_load.pcmf_getModel()).insertRow(Integer.parseInt(l_table.pcmf_getValue().toString()), l_row1);
61     l_table.pcmf_repaint();
62     
63     return;
64   }
65 }
66
Popular Tags