How do you specifically let an Itemlistener know which Item was selected?

How do you specifically let the Itemlistener know which Item was selected in a JComboBox? Anyone has any idea? What should the coding look like?

Hi,
Try this method
String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" };
JComboBox petList = new JComboBox(petStrings);
if ( petStrings[0]==(String)petList.getSelectedItem() )
System.out.println("I'm a bird");
}else{

Similar Messages

  • How do you specifically let the Itemlistener know which Item was selected..

    How do you specifically let the Itemlistener know which Item was selected in a JComboBox? Anyone has any idea? What should the coding look like?

    getSelectedItem()

  • SO Pricing User Exit - How to know which item is selected for re-pricing.

    Hello Experts,
    I have to modify material data when user does a update pricing in VA02, the problem is...How do I know which item is selected for re-pricing (in MV45AFZZ)? I am using user exit USEREXIT_PRICING_PREPARE_TKOMP.
    For Ex: If my order has 3 items and 2nd one is selected and then 'Update' is done on 'conditions' tab. Above pricing user exit is triggered 3 times for all items, so I cant check XVBAP.
    Your help will be appreciated.
    Thanks,
    Sagar

    Hi J@Y,
    Thanks for reply. But USEREXIT_PRICING_PREPARE_TKOMP is triggered for all items, so how do I know which is current item?
    If you see in debug mode, xvbap-posnr and tkomp-kposn will have 10,20,30 everytime (for 3 times). How do I know if user has selected 20?
    Thanks,
    Sagar

  • Knowing which Row was selected when Hide/Show is clicked

    Hi everyone,
    I have an advanced table, with some search criteria that works. I have added a "detail" flag and when I click the link Hide/Show, the details are displayed.
    How can I get in the code which Hide/Show link was clicked? I am more interesting in getting the Row from the VO which the Hide/Show link was clicked?
    When I get the "event" parameter from the pageContext (pageContext.getParameter("event") ) it returns "hide" or "show", but I don't know which was row that was clicked.
    What I am trying to accomplish is the following. In my advanced table I have "Select" checkBoxes. I want to add the "Hide/Show details" functionality and try to have the details displayed in an advanced table with its own "Select" checkBoxes.
    Can it be done?

    Hi,
    Create a Primary Key in View Object's Query for the table.
    Now to know on which row hide/show has been clicked you need to capture the row reference which is nothing but Primary Key for that row.
    Use this code in processformrequest:
    if(("hide".equalsIgnoreCase(pageContext.getParameter("event"))))
    String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    TestMassDeleteSearchVORowImpl row = (TestMassDeleteSearchVORowImpl)am.findRowByRef(rowReference);
    String lname = (String) row.getSelectFlag();//to get the value of checkbox
    Thanks,
    Gaurav

  • HT1212 How do you undisable an  iphone not knowing the passcode or not having been synced to itunes

    How do you undisable an iphone not knowing the passcode or being your phone being synced with itunes?

    http://support.apple.com/kb/ht1808
    Here you go : )

  • How to get the specific name of the workset which is currently selected by the user in sap portal 7.0

    Dear Expert,
    I have one requirement like to read the selected workset name in portal by the current user.I have read two documents regarding how to retrieve the PCD contents (iViews, Pages, Worksets and Roles) and its properties like Created by, Changed by, Last changed by and others using PCD API.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/6112ecb7-0a01-0010-ef90-941c70c9e401?overridelayout=true
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/508baf88-9335-2d10-efa6-c6ad61e5fc4b?quicklink=index&overridelayout=true
    But I am not able to understand how to get the specific name of the workset which is currently selected by the user.Can you please help me.
    I am using portal 7.0.
    Thanks & Regards,
    Patralekha

    Hi Expert,
    I found that we can use Interface INavigationHelperService to read Portal Role selected by user at runtime from http://scn.sap.com/thread/52194
    But this class is available in SAP NetWeaver 7.30 Enterprise Portal .
    But in SAP NetWeaver 7.0 Enterprise Portal that interface is not available.
    INavigationService is available there.
    But didn't get any proper discussion on this interface for the same requirement.
    Can you please help me.
    Thanks & Regards,
    Patralekha

  • How come property attribute of jsp:getProperty  knows which method to call

    Hello friends,
    I could not understand How come property attribute of <jsp:getProperty knows which method to call
    <jsp:useBean id="test" class="BeanTest.testing" scope="page" />
    <jsp:getProperty name="test" property="name" />
    there is no method "name" in testing.class file
    if u see the existing examples "date" given in TOMCAT , it is using many <jsp:getProperty tag, but the property name is not equal to the method method name in the Bean file
    thanks,

    First do you know what a
    bean property sheet is?
    If not say so.
    Second, to your question
    The Java Runtime Environment (JRE) uses introspection to identify the appropriate get() or set() methods of that bean. What is introspection?
    Introspection is a process that allows the class to expose its accessable variables and methods and allows other classes to see what they can do with that class when requested. Eg:
    public class MyBean{
    private String someValue = null;
    public MyBean(){
    someValue = "Some String Value";
    //Introspection will reveal this method
    public String getSomeValue(){
    return someValue;
    } and
    <jsp:getProperty name="...." property="someValue" />
    will call the getSomeValue() method

  • Hierarchical Tree. How do I know which node is selected.

    Hi All,
    I have a Hierarchical tree, How do I know which node is selected
    by the user. Similar is the case with list item.
    Thank You,
    Raj.

    Raj,
    For the hierarchical tree, use the when-tree-node-activated
    trigger and the Ftree.Get_Tree_Node_Property built in to identify
    the node that was selected.
    For a list box use a when-list-changed trigger. To refer to the
    value of the selected list item you can use the block.item
    syntax.

  • How do you print a list of bookmarks which includes addresses and properties?

    How do you print a list of bookmarks which includes addresses and properties?

    Which properties do you want included?
    See also:
    *[[/questions/748417]]

  • Premiere CS4 - How can you import QuickTime (.mov) videos and which settings for the sequence?

    Premiere CS4
    How can you import QuickTime (.mov) videos and which settings for the sequence?
    Please reply in plain English or if possible in German
    Greetings from Vienna, Peter

    I have not installed Quicktime.
    I got a few scenes (.mov) from a Canon Eos 70d.
    I want to create a short film (in Premiere CS4) with these scenes, mixed with photos and MP3 music.

  • How Do I Know Which commandButton was Clicked in the Validation Phase?

    I have three <h:commandButton ... /> components in a single form. In order to implement some validation rules, I need to know which one was clicked. I cannot rely on the configured actionListener methods because they have not yet been invoked in the JSF life-cycle.
    It seems that the components representing each of these buttons get created and their values are all set to null. So that doesn't help.
    I could set a hidden field using a JavaScript onclick event handler, but that seems to be a hack for something that any decent web application framework should be able to handle elegantly.
    Thanks in advance for any help.
    Atif Faridi

    Thanks for the quick reply.
    I considered that, but ruled it out as an option because I was convinced that JSF would offer something better.

  • UITextField and knowing which one was first responder

    I have a app with several UITextFields and I want to know which textfield was the first responder within the function.
    ie I have a text field created in interface builder and its outlet is assigned to nameField.
    So how can I know when nameField was the one that received the input from the keyboard of DONE ??
    - (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
        return YES;
    I've tried
    - (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
        [theTextField resignFirstResponder];
        if(theTextField == nameField)
            NSLog(@"I got here");
        return YES;
    But my NSLog output is not sent, so I don't know why theTextField is evaluating to false.
    Thanks

    Take a view based application and name it as textField.
    Make Sure that in interface builder set each textField delegate to File's Owner. Otherwise it won't work.
    Here is the code:
    textFieldViewController.h
    #import <UIKit/UIKit.h>
    @interface textFieldViewController : UIViewController <UITextFieldDelegate> {
              UITextField *textField1;
              UITextField *textField2;
              UITextField *textField3;
              UITextField *textField4;
              UITextField *textField5;
    @property (nonatomic, retain) IBOutlet UITextField *textField1;
    @property (nonatomic, retain) IBOutlet UITextField *textField2;
    @property (nonatomic, retain) IBOutlet UITextField *textField3;
    @property (nonatomic, retain) IBOutlet UITextField *textField4;
    @property (nonatomic, retain) IBOutlet UITextField *textField5;
    @end
    textFieldViewController.m
    #import "textFieldViewController.h"
    @implementation textFieldViewController
    @synthesize textField1;
    @synthesize textField2;
    @synthesize textField3;
    @synthesize textField4;
    @synthesize textField5;
    - (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
              [theTextField resignFirstResponder];
              if (theTextField == textField1)
                        NSLog(@"I Got here");
              return YES;
    - (void)dealloc {
              [textField1 release];
              [textField2 release];
              [textField3 release];
              [textField4 release];
              [textField5 release];
        [super dealloc];
    @end

  • How can I know which link was clicked in the link list

    Hi everyone
    I'm using list of links in my page to display list of the files in some directory.
    How can I know which link user was clicked. There are some code:
    <%
    String dir = "..//files//";
    File fin = new File(dir);
    File files[]=fin.listFiles();
    for(int i=0;i<files.length;i++)
    File x = files;
    %>
    <%=x.getName()%><br>
    <%
    %>
    Please help

    You need to pass some data on the querystring to the page you are linking to.
    <a href="Main_Work.jsp?file=<%=x.getName()%>"><%=x.getName()%></a><br>
    This will send a parameter called "file" with the value of the file name that the user clicked.
    Now in Main_Work.jsp you can access this data as follows:
    <%
    String s = request.getParameter("file");
    File f = new File("..//files//"+s);
    %>

  • How do you change the music for an export from a selection of pictures?

    I have iTunes and know how to change the music for a slideshow but if I select pictures from a folder and export to QuickTime how do I change the music?
    There is an option to "Add currently selected music to movie" but it always plays the same tune. How do I get an option to select an iTunes song like with the Slideshow? Where are the slideshow sample music files stored? There are 11 files in the sample folder but I can't find any of them on my drive.

    Maybe there is some confusion in what I'm telling you. There are two types of slideshows in iPhoto. One creates a special slideshow album that appears in the Source pane on the left side. This is not the one I'm talking about. (You create one of these slideshow albums when you select some photos and click the Slideshow icon (the one with a Plus sign on it) at the bottom of the iPhoto window.
    The other slideshow is done from the main library window or from a regular album (not a slideshow album). You either select some photos (or a roll) from the Library or select an album (with a folder icon). Then click the Play button which is on the bottom right hand side of the iPhoto window.
    If your Play button is on the left side, then you aren't using the correct one. The one that appears on the left side shows when you've selected a Slideshow Album from the source pane. This type of album has an icon that looks like a couple of slides (the kind you put in a projector).
    Does that make a difference?

  • OS 4 disaster, how do you roll back to 3.13 (or whichever was the previous

    Hi all, first time poster.
    First of all with previous OS's not a problem, however this one is possibly not even worthy of OS 0.4 never mind 4. I've been following everyones guide on how ot cope with the poor battery life (which likes to drain completely over night, not good when I use it as an alarm. I've tried turning off notifications, push etc, tried and installed from http://support.apple.com/kb/TS3398, let the battery charge fully deplete fully then charge fully. And I have restored the system settings twice. As such until Apple properly fix this issue I want/need (so I don't miss an alarm going off) To roll back to the previous OS. Does anyone have any advise or can you tell me how to rollback to the previous OS. Thank you.

    you can change the gestures back in the system prefs if you prefer it the other way as I did.

Maybe you are looking for

  • Mass processing for inbound orders idoc's from file

    Hi Experts, I have an requirement wherein we need to process all the ORDERS idocs sent from a thrid party system to a particular folder in the SAP system. Now we use a custom programme which in turn calls fn module IDOC_INBOUND_FROM_FILE to process e

  • Multiple Joins from one Dimension Table to single Fact table

    Hi all, I have a single fact table with attributes as such: Action_ID Action_Type Date_Started Date_Completed and a Time Dimension to connect to the fact table. Currently the 2 Date columns in my fact table are in the format of 20090101 (which is the

  • Zero divide error in my query sq01

    Hi Gurus I keep getting a 0 divide error in my query, I think it's because some of the invoices have 0.00 dollars amount, t For Contribution Margin in sq01 I wrote a formula in Calculation formula CONT_MARG / (MAT_PRC-FRGT_PROV + DISC_SURC+FREIGHT )

  • Encore 2.0 does not show slideshow subtitiles in preview or DVD

    I see this same problem in the past few months with CS3. I have the Master Collection with CS4 that has never worked on both my computers. My old copy of Encore 2.0 does work but I can't figure out how to add subtitles to my 37 slides.  I clicked add

  • Can I run Illustrator CS3 on G4 with Jaguar OS?

    Looking to get the update, but noticed the system requirements were G4-G5 Leopard OS with 1GB RAM recommended. Just curious if anyone is running on G4 with Jaguar, or if G5 purchase would be needed (I'd rather purchase than upgrade my G4 with RAM and