KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > helloworld > listeners > HelloWorldAddListNode_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 21.02.2005
12  *
13  * date: 21.02.2005
14  * project: WiSer-HelloWorld
15  *
16  * *******************************************************************************/

17
18 package helloworld.listeners;
19
20 import Jmc.baseGui.*;
21 import Jmc.commonGui.*;
22 import Jmc.commonGui.loader.*;
23 import Jmc.baseTools.*;
24
25 import javax.swing.*;
26
27 /**
28  * @author Dirk
29  *
30  * date: 21.02.2005
31  *
32  * <p>
33  * Purpose: This listener inserts a new item into the list model of the listBox. It shows the
34  * connection between model and view
35  * </p>
36  */

37 public class HelloWorldAddListNode_li implements base_guiListener
38 {
39   /**
40      * <p>
41      * This method is called whenever the button is pressed.
42      * </p><p>
43      *
44      * </p><p>
45      * @param xParam the widget which generates 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_inputField_if l_inp = (base_inputField_if)base_registredObject.pcmf_getObjByName("myNodeListInput");
52     base_listLoader l_load = (base_listLoader)base_registredObject.pcmf_getObjByName("listLoader");
53     
54     // add new Value to the model
55
((DefaultListModel)l_load.pcmf_getModel()).addElement(l_inp.pcmf_getValue());
56         
57     return;
58     }
59 }
60
Popular Tags