Using List Selection Listeners....Please GUIDE

Hello
I am using Java Swing and am displaying elements using JList.
Each element of the List performs a certain function.
On press of the Key,the function is invoked.
Now,I am using the ListSelectionListener for moving up and down the list
and the KeyListener for selecting the element on press of the Key.
I would like to combine both of them into one (i.e go up and down the list
and on press of the key the concerned element chosen performs the function).
How can I combine both of them?
At present this is what I am doing..I'd like to combine this together
Please can anyone help
m_list.addListSelectionListener(
          new ListSelectionListener(){
               public void valueChanged(ListSelectionEvent e){
               System.out.println(m_list.getSelectedValue());
// ** item selected and key pressed.
m_list.addKeyListener(new KeyAdapter() {
     public void keyPressed(KeyEvent e) {
                                     int keyCode = e.getKeyCode();
                     if (keyCode == KeyConstants.VK_ACTIVATE) {
                 // PERFORM THE Element function.                                                  
});

You sound like you want to use actions. See [url /thread.jsp?forum=57&thread=401315]this thread (you can ignore the text field part).
Kind regards,
  Levi

Similar Messages

  • When do I use the ClassLoader? Please Guide.

    Hello there,
    When do I need to use the ClassLoader Class?
    Please can some one write a small code that can
    explain the above class usage?
    Regards

    In my case, I use URLClassLoader to load classes during runtime. I have a program that lets users load questionnaires (which are compiled java code in jars) into a client package which knows how to view them.

  • Where used list is not working for IMG nodes/Document   in solar01

    hi experts
    In template project , we are using same IMG objects in different business processes and subsequent configuration document is attached to each IMG node in configuration tab.  ( like same IMG node  -  define order types used in different business process configuration tab )
    when i use " where used list " from the configuration tab , its not showing the IMG objects  used in different business processes in the same project. whereas its showing the IMG nodes used in the different project.
    I need to find out the same IMG objects/ document  used in the same project using the " Where used list " button.
    Please provide your answers
    Note : we have linked one configuration document to same IMG nodes used in different business. " where used list " also not working for documents as well
    Thanks
    Sol man

    Hello there,
    I just tried some tests and couldn't face any problem with locating other usages for the objects in configuration tab.
    You mentioned a configuration document, so have in mind that the document usage will only be considered if it is a link to the same document and not just a copy.
    e.g:
    Here I created a document in this node:
    Then I added it as a link here:
    and as a copy here:
    When I go back to the original node and use the where-used, it'll only show the original and the link:
    This happens because after copying a document, it is considered as a new one instead of another usage of the original one.
    best regards,
    Fabricius

  • For Multi Selection of Whare used list

    Dear Friends,
    I have Used T-code CS-15 for whare used list of material. if any other T-code for multi selection of materials for where used list.
    Please write.
    Thanks & Regards
    Ajit Sharma

    Hi Ajit,
    As mentioned in the previous posts, it is not adviced to have a multiple selection where-used, as the runtime is very long for this report.
    But if there is a specific need, you can build a Z report by using the FM -> CS_WHERE_USED_MAT
    But do ensure that your abaper puts in some restriction criteria. In the z report which i had done in one of the projects, i had put a restriction of 10 materials as the runtime was long.
    If helpful award points
    Regards,
    Vivek

  • PLease guide me to use vendor sub range with functionality

    Dear All,
    PLease guide me to use vendor sub range with functionality
    thx

    Hi,
    The basic concept of Vendor Sub Range is to use different Purchasing Data as well as Partner Functions for a particular range of products supplied by individual your vendor.
    In SPRO you can activate  Vendor Sub-range in following path
    SPRO->Logistic General->Business Partner->Vendors->Control->Define Account Group & Field Selection
    In this screen Select your Vendor account group and double click, sys will take to new screen and here you select check box of Vendor sub-range relevant in data retention level-poaching tab and save.
    Now create following master data:
    Let’s say you’re purchasing two pumps from your Vendor (V), HDPE and SS manufactured by different company (HDPE and SS ) & they have different purchasing data like payment terms, delivery term etc…
    1. Create two materials HDPE and SS
    2. Create Vendor (V)
    3. Create Info record (ME11) M1 & M2 with vendor (V) and here in each material maintain vendor sub range
    4. Now create PO (ME21), all related data you will get in PO w.r.t. material and save.
    Regards,
    Biju K

  • I replaced the original hdd in my early 2008 iMac.  I can't move my files that were backed up with Time Machine to my new hdd using Migration Assistant.  When prompted to select the "from drive", the ext. hhd does not appears as a selection. Please help!!

    I replaced the original hdd in my early 2008 iMac.  I can't move my files that were backed up with Time Machine to my new hdd using Migration Assistant.  When prompted to select the "from drive", the ext. hhd does not appears as a selection. Please help!!

    I'd recommend staring over, Pondini has created an excellent guide on how to use Setup Assistant. I'd recommend begin reading Pondini Setup Assistant tips where he talks about "Second Chance." Assuming your Time Machine backup is sound the restore  should be very smooth.
    Roger

  • Domain selection in logon page..Please guide

    Hello All,
    We need to provide a dropdown list wherein user can choose his/her domain and login into portal.
    Any ideas as to how can I change the current request paramaters to add in the domain + get the response accordingly.
    Please guide.
    Thanks and Warm Regards,
    Ritu

    Hello Ritu,
    For any portal the logon page comes from the logon par which is com.sap.runtime.logon.par. This par file's usage is mentioned in the authschemes.xml file.
    Check this url if you would want to customize the existing logon page:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/371e9d90-0201-0010-c39c-fd2956154ab3
    You can customize the logon page by including the dropdown to the logon.jsp.
    But then if the logon depends on the dropdown, then it is better to have a separate portal application which has a jsp which gets displayed when the application is called.
    Your .par file (a jspdynpage) would have a jsp which would have a jsp containing customized fields (user name, password and domain dropdown). The core part would have the logic which would use UME api to validate the credentials and extra logic to determine the domain also.
    But again to use this login page, the url has to modified to call the application name such as http://<host>:<port>/irj/portal/myApplication.
    Regards,
    Sujana

  • Using multiple select lists in ADF

    Hi,
    I am trying to use a multiple select list in my JSP page, and have a method in the ApplicationModule be called when the Struts action is called. I am following the example ADF tutorials, where the method is added to the ApplicationModule class, then dragged onto the Stuts Flow diagram (to associate it with an action).
    I am able to create a dyna form bean for the page that contains the multi select as a type "java.lang.String[]" (string array). I am able get that values that were selected in a normal action's "execute" method. For example:
    msf = (DynaActionForm) form;
    String[] statusSelection = (String[]) msf.get("multSelectList");
    However, I cannot seem to get the "multSelectList" values into a method in my Application Module class. The "multSelectList" is defined in my dynaFormBean as a String[] type. I am passing it in as an argument like the following....
    public void setParams(String multSelectList[]) {
    This results in the method not being called at all. I am not sure why. Does this have something to do with a String[] not being serializable??
    However, if I just attempt to pass other types form items to the method, it works. For example:
    public void setParams(String simpleCheckbox) {
    Does anyone know how to use multiple select lists in conjunction with ADF?
    P.S.
    my multSelectList looks something like this:
    <select name="multSelectList" multiple size="5">
    <option value="ALL">Select All</option>
    <option value="preferred">Preferred</option>
    <option value="standard">Standard</option>
    <option value="approved">Approved</option>
    <option value="interim">Interim</option>
    </select>

    I got this working by changing the signature of the Application Module method to use ArrayList rather than String[], then you can marshal the Struts FormBean contents into an ArrayList to pass up.
    To do this, subclass the DataAction by using "Go To Code" off of the context menu and then override the initializeMethodParameters() method:
      protected void initializeMethodParameters(DataActionContext actionContext, JUCtrlActionBinding actionBinding)
        //Get the String Array from the Form Bean
        String[] selection = (String[])((DynaActionForm)actionContext.getActionForm()).get("multiSelect");
        //convert that to an ArrayList
        ArrayList selectionArr = new ArrayList( Arrays.asList(selection));
        //Add that object to the Arg List for the AM method
        ArrayList params = new ArrayList();
        params.add(selectionArr);
        actionBinding.setParams(params);
      }

  • I want to change my primary e-mail address that I use with Apple ID - help guide says Select Edit next to "Apple ID and Primary Email Address." But there is no 'edit' on that section there is on every other but not that one. Can anyone help?

    I want to change my primary e-mail address that I use with Apple ID - help guide says Select Edit next to “Apple ID and Primary Email Address.” But there is no 'edit' on that section there is on every other but not that one. Can anyone help?

    You can create an alias @icloud.com email address within your current account that will receive email in your current iCloud inbox (see http://help.apple.com/icloud/#/mm6b1a490a).  (@me.com addresses are no longer available as new addresses.)  Just be aware that you cannot use an alias address later to create a new iCloud account or move it to a different account.
    Also, even if you created a new iCloud account with a new ID, your existing purchases would not be lost.  They are permanently tied to the original ID you used to purchase them.  You can also continue to use the existing ID for the iTunes store; it does not need to be the same as the ID you use for iCloud.

  • Using a Select list with Submit

    I am trying to use the select list with Submit on my page.
    I have 3 select lists.
    On the first one,I am showing the list of all jacks.
    When the user selects a jack from the first list, I want to show all the jacks except the one which was selected.
    When the user selects a jack from the second list, I want to show all the jacks except the ones selected in the first list and the second list.
    I have created the select lists with submit and then I have put the query for getting the jacks. I created an unconditional branch. I am also passing the variables so that I can set the values of the items on submit.
    I also created a computation as mentioned in one of the OTN discussions, and have mentioned the value of second list to be calculated from the first and 3rd from first and second.
    But after clicking the first select list, I am losing all the existing values on the first page. I wonder what I am missing here. Can anyone hellp?
    Thanks,
    Gargi

    Gargi,
    In this case using 'select list with redirect' makes more sense rather than with SUBMIT. So change all the select lists to 'select list with redirect' (it redirects to same page inserting 'select list' value session state).
    Now for the 2nd select list query add a condition in where clause like
    WHERE sl_col != :P1_SL1And for the 3rd select list query add a condition in where clause like
    WHERE sl_col NOT IN (:P1_SL1, :P1_SL2)Hope it helps :-)
    Cheers,
    Hari

  • I am using iphone 5s, i want to send group sms , please guide how to do group sms.

    1 - i am using iphone 5s, i want to send group sms , please guide how to send.
    2- how to sync address book with catagory on outlook to iphone 5s. when i sync catagory does not sync , only address book do.
    it catagory sync, it we can make group easyly. is it possible.
    if not is there any way to get it , as this is very important feature.

    Read the User's Guide, it covers basic functionality of the device.

  • How can we use list box on selection screen

    hi, howe can we use list box on selection screen and how can we populate the dat ainto the list box and how can we retrive data based on list box from ther database.
    thanks in advance
    raju

    Use the VRM_SET_VALUES function module.
    DATA: list              TYPE vrm_values,
          value             LIKE LINE OF list.
               AT SELECTION SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      name = 'P_OBJECT'.
      CLEAR list.
      REFRESH list.
      CLEAR value.
      value-key = '1'.
      value-text = 'Development Class'.
      APPEND value TO list.
      CLEAR value.
      value-key = '2'.
      value-text = 'Program'.
      APPEND value TO list.
      CLEAR value.
      value-key = '3'.
      value-text = 'Function Module'.
      APPEND value TO list.
      CLEAR value.
      value-key = '4'.
      value-text = 'Database Table'.
      APPEND value TO list.
      CLEAR value.
      value-key = '5'.
      value-text = 'Structure'.
      APPEND value TO list.
      CLEAR value.
      value-key = '6'.
      value-text = 'View'.
      APPEND value TO list.
      CLEAR value.
      value-key = '7'.
      value-text = 'Data Element'.
      APPEND value TO list.
      CLEAR value.
      value-key = '8'.
      value-text = 'Table Type'.
      APPEND value TO list.
      CLEAR value.
      value-key = '9'.
      value-text = 'Class / Interface'.
      APPEND value TO list.
      CLEAR value.
      value-key = '10'.
      value-text = 'Type Group'.
      APPEND value TO list.
      CLEAR value.
      value-key = '11'.
      value-text = 'Domain'.
      APPEND value TO list.
      CLEAR value.
      value-key = '12'.
      value-text = 'Search Help'.
      APPEND value TO list.
      CLEAR value.
      value-key = '13'.
      value-text = 'Lock Object'.
      APPEND value TO list.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = name
          values          = list
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

  • I am using windows 8. I have downloaded i tunes. but i can not find my i phone any where in i tunes menu. so I am having problem in syncing my phone. please guide me

    I am using windows 8. I have downloaded i tunes. but i can not find my i phone any where in i tunes menu. so I am having problem in syncing my phone. please guide me

    If the device doesn't appear as shown in the following instructions: http://support.apple.com/kb/HT1386
    then the following may help: http://support.apple.com/kb/TS1538

  • Dear all, I am using Safari Version 5.0.6 (5533.22.3) but I cannot read any Nepali or hindi text. It shows sort of box sign "द". Please guide me to fix it, I will really appreciate your help.

    Dear all, I am using Safari Version 5.0.6 (5533.22.3) but I cannot read any Nepali or hindi text. It shows sort of box sign "द". Please guide me to fix it, I will really appreciate your help.

    gyanu1812 wrote:
    This is the snapshot of an email that if you have sent it to me.
    No, that is the snapshot of my posting in this forum.   Here is a picture of my sent message.  Are you not getting my emails sent directly to you?

  • Using a selection option Var on a restricted list of values for  a char

    hi all,
    i am trying to use a selection option variable in a restricted list of values in a characteristic. for example. company code has the following values:
    1) GB01
    2) GB02
    3) GB03
    4) MY01
    5) SG01
    and so on.....
    Now, i would like to restrict the list of values into GB01, GB02 and MY01.
    and based on this restricted list, i will again need a variable to do a selection option in the report.
    Do you think this is possible? what will be the solution to this?
    i have tried to restricted it with 2 variables but it doesnt allow that.
    cheers,
    willie

    ADF Faces has a very small learning curve, at least
    on top of learning JSF itself, - it's a JSF component
    library with some extra JSF framework features, but
    you can use only the bits you want. It is
    proprietary to the extent that you're using some code
    that isn't a standard, but we run right on top of the
    JSF standard (and you can use either MyFaces or the
    Sun RI), so there's not a whole lot of lock-in.Ok sounds good and I am aware of a lot of the work that Oracle has been doing. I would like though ask you some additional questions.
    Could you contact me at [email protected] if it is not too much trouble.
    Thanks much.

Maybe you are looking for