KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > helloworld > listeners > HelloWorldTableRemove_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 removes a row to the table.
35  * </p>
36  */

37 public class HelloWorldTableRemove_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     // get all relevant widgets from the registry
51
base_table_if l_table=(base_table_if) base_registredObject.pcmf_getObjByName("atable");
52     base_tableLoader l_load = (base_tableLoader)base_registredObject.pcmf_getObjByName("tableLoader");
53   
54     if (l_table.pcmf_getValue() == null)
55       return;
56     
57     // remove row
58
((DefaultTableModel)l_load.pcmf_getModel()).removeRow(Integer.parseInt(l_table.pcmf_getValue().toString()));
59     l_table.pcmf_repaint();
60     
61     return;
62   }
63 }
Popular Tags