How can I get the selected row's index of a Jlist wrapped with JScrollpane?

the problem is that I can use getSelectedIndex() only if the JList is not wrapped in a JScrollPane.
but in my program the JList IS wrapped in a JScrollPane.
when I select one item of the jscrollpane I can't catch the event.
please F1 me.
Lior.

What difference does it make if the list is inside a scroll pane or not? If you have a member varialbe that references the list you can call getSelectedIndex when ever you need.
    myList = new JList (...)
    someComponent.add (new JScrollPane (myList));
    //  Then later
    int sel = myList.getSelectedIndex ();And you can always be up on any selection chagnes in the list by supplying it with a ListSelecitonListener.

Similar Messages

  • How can I get the selected rows from two ALV grids at the same time?

    I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
    The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
    It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
    As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
    How can I select the rows, then click on just one button, and process the marked entries from both grids?
    Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
    Thanks.

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

  • How can we get the selected line number from JTextArea ?

    how can we get the selected line number from JTextArea ? and want to insert line/string given line number into JTextArea??? is it possible ?

    Praitheesh wrote:
    how can we get the selected line number from JTextArea ?
    textArea.getLineOfOffset(textArea.getCaretPosition());
    and want to insert line/string given line number into JTextArea??? is it possible ?
    int lineToInsertAt = 5; // Whatever you want.
    int offs = textArea.getLineStartOffset(lineToInsertAt);
    textArea.insert("Text to insert", offs);

  • In Messages, how can I get the most recent entries to appear on top, like with my emails?  Thanks!

    In Messages, how can I get the most recent entries to appear on top, like with my emails?  Thanks!

    HI,
    A Note.
    Technically the most recent Conversation (or Chat) that has a new message (be it iMessage or IM) will move to the top in the list on the left if it is set in the View  Menu to do so.
    Obviously this does need more than one Conversation or Chat to be listed to work.
    It does not change the focus of the Chat/Conversation you are viewing.
    iChat - the forerunner naver had an option to invert the chats.
    The iChat Feedback page is where I use.
    You will also see it does not list iChat 6 depsite listing Lion.
    In this sense it has always beeen out of step on the iChat/Messages version front  (it took me a long time via the Lounge and Host help to get it on the list of pages to be updated on New OS versions)
    11:00 PM      Friday; June 28, 2013
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.4)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • How can i get the failed row numbers in batch insertion?

    Afeter execution of batch insert operation into a table, i use OCIAttrGet() to get the error number of insertion, as expected, it returns the correct number. however, when i use OCIParamGet() to get an error handle and then to get the exact failed row numbers , OCIParamGet() returns -2 , means "INVALID_HANDLE". can anyboy tell me why ? how can i get the exact failed rows?
    the snapshot of my code :
    int errNum = 0;
    int nRet = 0;
    nRet = OCIAttrGet((dvoid *)m_pIIOdbc->m_pStmtAll,OCI_HTYPE_STMT,&errNum,
              0,OCI_ATTR_NUM_DML_ERRORS, m_pIIOdbc->m_pErrHandle);
    if (errNum)
         OCIError* pErrHndl;
         int* pRow_off = new int[errNum];
         for (int i = 0; i < errNum; i++)
         nRet = OCIParamGet(m_pIIOdbc->m_pErrHandle,
    OCI_HTYPE_ERROR, m_pIIOdbc->m_pErrHandle, &pErrHndl, i + 1);
         nRet = OCIAttrGet (pErrHndl, OCI_HTYPE_ERROR, &pRow_off, 0,
         OCI_ATTR_DML_ROW_OFFSET, m_pIIOdbc->m_pErrHandle);
              delete []pRow_off;

    now the code is :
    OCIEnv      *m_pEnvHandle;                    
    OCIError      *m_pErrHandle;                         
    OCIError     *m_pErrHandle2;                    
    OCIServer *m_pSrvHandle;                         
    OCISvcCtx *m_pSvcHandle;                         
    OCIStmt *m_pStmtExec;
    OCIStmt *m_pStmtAll;
    OCIError** m_pErrorHndl;     
    int* m_pRowOff; //the array that will contain the failed row numbers
    int     m_nArrayLength; //length of array in once batch operation
    int m_nErrNum; //error number
    int m_nSucCount; //successful record number
    //initialization
    //m_nArrayLength is a parameter passed in, so i can not tell the exact length of the array, dynamic space allocation is needed
    m_pErrorHndl = new OCIError*[m_nArrayLength];
    m_pRowOff = new int[m_nArrayLength];
    //execution
    OCIStmtExecute(
              m_pSvcHandle,
              m_pStmtAll,
              m_pErrHandle,
              (ub4)m_nArrayLength,
              (ub4)0, (OCISnapshot *)NULL, (OCISnapshot *)NULL,
              OCI_BATCH_ERRORS
    //get successful records number
    m_nSucCount = 0;
    OCIAttrGet((dvoid *)m_pStmtAll,OCI_HTYPE_STMT,&m_nSucCount,
              0,OCI_ATTR_ROW_COUNT, m_pErrHandle);
    //get error numbers
    m_nErrNum = 0;
    OCIAttrGet((dvoid *)m_pStmtAll,OCI_HTYPE_STMT,&m_nErrNum,
              0,OCI_ATTR_NUM_DML_ERRORS, m_pErrHandle2);
    //get failed row numbers into the array
    if (m_nErrNum)
              //get failed row numbers into the array
              for (int i = 0; i < m_nErrNum; i++)
                   //initiallize error handles               OCIHandleAlloc((dvoid*)m_pEnvHandle, (dvoid**)&m_pErrorHndl,
                        OCI_HTYPE_ERROR, (size_t)0, (dvoid**)0);
                   OCIParamGet(m_pErrHandle, OCI_HTYPE_ERROR, m_pErrHandle2, (void**)&m_pErrorHndl[i], i);
                   OCIAttrGet (m_pErrorHndl[i], OCI_HTYPE_ERROR, &m_pRowOff[i], 0,
                                            OCI_ATTR_DML_ROW_OFFSET, m_pErrHandle2);
    now, if batch insert is executed, eg, there are 10 records to be inserted, thus m_nArrayLength is set to be 10. There are 5 records of the 10 have exist in database, so some of insert operations will fail. After execution, m_nErrNum is 5, and i can get the failed row numbers.Everything seems go well.
    However, if batch updata is excuted, eg, 10 records to be updated, m_nArrayLength is set to be 10, and also there are 5 records of the 10 have exist in database. After execution, the OCIStmtExecute() returns 1, m_nErrNum got by
    OCIAttrGet((dvoid *)m_pStmtAll,OCI_HTYPE_STMT,&m_nErrNum,
              0,OCI_ATTR_NUM_DML_ERRORS, m_pErrHandle2)
    is 0, and m_nSucNum is 5. Why?? how can I get the rows that fail? i have to know which rows do not exist in database??

  • How can i get the selected PageItem in InDesign

    Hi
    i received the hint to post the message into this forum. so i try it...
    After implementing a floating panel and receiveing the "afterSelectionChanged"-Event i would like to get the selected PageItem, if one is selected...
    In the datastructure i can only find the activeLayer (event.target.activeLayer)  and the activePage (event.target.activeLayer), but no activePageItem or so.
    Is there a possibility to get this PageItem?
    best thanks for any hint.
    Lorenzo

    Lorenzo,
    This is the SDK forum. David sent you to the scripting forum: http://forums.adobe.com/community/indesign/indesign_scripting
    But I already answered on the CS SDK forum http://forums.adobe.com/message/3915745#3915745
    Harbs

  • How can i get the selected portal theme

    Hi all,
    it is possible to get the current used portal theme.
    I need the path to the css file of the current selected theme.
    I've tried to get the css file over the pageContext like:
      pc.getStylesheetUrl()
    But the result of this methode is: /htmlb/mimes/ur/ur_ie6.css
    I'm loking for an url like:
    /irj/portalapps/com.sap.portal.design.portaldesigndata/themes/portal/sap_standard/ur/ur_fc_ie6.css
    Torsten

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

  • HT1349 My Ipad was stolen, How can I get the serial Number from Apple. It was registered with them

    I had  2 Ipads, a mac book pro and a Mac Air stolen 2 weeks ago
    I am trying to locate one of the serial numbers, but cant find the last box.  Can I get the serial number from Apple. It was registered and now it is not showing up as one of my products.
    Thanks

    The easiest way to find your serial number is this Open Itunes...click help... run diagnostics.....(tick or untick as necessary) so that you just have ticked the last two,  device connectivity and device sync.  run these tests. it will say no ipod/ipad found but will give results of test....scroll down to bottom of results... here you will find the serial number of your last attached devices.

  • How can I get the selected action of content type by javascript from Firefox Options Applications?

    I works on my website, and it have to check the PDF file will be opened in which plugins
    So we have to implement some javascript to check the selected action of Content Type from Tool>Options>Application
    Do we have any javascript code to check this

    You can't check this with code that runs on the server or via JavaScript in the web page.
    Note that current Firefox version do not expose the built-in PDF Reader via the navigator.plugin array, so if you can't detect a plugin than maybe assume that the built-in PDF reader is used with Firefox version 19 and later.
    *Bug 840439 - Expose PDF.JS as a plugin navigator.plugins when enabled

  • Getting the Selected Row from a JTable

    hi,
    how Can i get the Selected row from a JTable
    thanks...

    You know that JTable class? Well, you see those methods in it called "getSelectedRow()" and "getSelectedRows()"...?

  • How can i get the external Sql result return data to abap?

    Dear All
             I have a problem to how to get the select  result data return abap.
    I used abap to run external SQL server. below is my code:
    ***in above ,abap has already connected external SQL.
    Sql = u2018select * from user01u2019
          CALL METHOD OF rec 'Open'
            EXPORTING #1 = sql
            #2 = con
            #3 = '1'.
          IF NOT sy-subrc = 0.
            MESSAGE e000 WITH 'run external sql error!'.
          ENDIF.
    ***now ,below code how can I get the select result to abap code?
    I know I can use native_sql  such as u2018OPEN CUR1 FOR SELECT * FROM user01 AND FETCH NEXT CUR1 INTO :WAu2019.
        Thanks for all
    Sun

    Thanks.
    it is okay now by myself.
    con_str = 'Provider=SQLOLEDB.1;Password=pwd;Persist Security Info=True;User ID=name;Initial Catalog=VTL_DEMO;Data Source=192.168.21.50'.
      CREATE OBJECT o_conn 'ADODB.Connection'.
      CREATE OBJECT o_rec 'ADODB.Recordset'.
      SET PROPERTY OF o_conn 'Provider' = provider.
      SET PROPERTY OF o_conn 'ConnectionString' = con_str.
      CALL METHOD OF o_conn 'Open'.
      sql_str = 'select *  from userh'.
      CALL METHOD OF o_conn 'Execute' = o_recordset
        EXPORTING
        #1 = sql_str.
       #2 = o_conn.
      GET PROPERTY OF o_recordset 'EOF' = rs_eof.
      REFRESH itab.
      WHILE rs_eof NE 1.
        CALL METHOD OF o_recordset 'fields' = o_field
          EXPORTING
          #1 = 0.
        GET PROPERTY OF o_field 'Value' = itab-name.
        CALL METHOD OF o_recordset 'fields' = o_field
          EXPORTING
          #1 = 1.
        GET PROPERTY OF o_field 'Value' =  itab-cid.
        APPEND itab.
        CALL METHOD OF o_recordset 'MoveNext'.
        GET PROPERTY OF o_recordset 'EOF' = rs_eof.
      ENDWHILE.

  • How can I get the index of the selected row, ALV

    In alv I need to get the selected row id and then calling a screen to show the detailed infomation on this row and providing the ability to update the row.
    I know how to do but do not know how to get the selected index of the alv grid.
    If it was desired based on just double click, it was ok but I have to provide a button and when it is clicked the detailed screen will come with the selected row details.
    Thanks everyone.
    Deniz.

    Hi Deniz,
    While defining the internal table which u pass in ALV_GRID function module, define a field (suppose CHECK type c) in the structure of that internal table.
    and while defining field layout, pass the value 'CHECK' to the field BOX_NAME of the layout.
    Now, when you execute the report, a selection box will be displayed infront of every record. If you select that record and press the button on application tool bar, the field 'CHECK' in the internal table will be having the value 'X'... By looping throught this internal table where check = 'X', you can achieve your functionality.
    Example:
         Structure for output details
    TYPES: BEGIN OF GS_OUTPUT.
            INCLUDE STRUCTURE ZAS_WATER_QLTY_REP.
    TYPES: CHECK(1) TYPE C,
           END OF GS_OUTPUT.
        Internal    table for output details
    DATA: GT_OUTPUT   TYPE STANDARD TABLE OF GS_OUTPUT.
    Before calling the function module to display ALV
    grid, define a layout usine
    Local workarea
      DATA: LW_LAYOUT  TYPE SLIS_LAYOUT_ALV.
    Local constants
      CONSTANTS: LC_UFORM  TYPE SLIS_FORMNAME
                        VALUE 'ALV_USER_COMMAND'.
    LW_LAYOUT-BOX_FIELDNAME = 'CHECK'.    "Field for checkbox
    This function module outputs an internal table with whatever
    structure in the form of a formatted single- order multi-line list
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = LV_REPID
                I_CALLBACK_PF_STATUS_SET = G_FORM_SET_PF_STAT
                I_CALLBACK_USER_COMMAND  = LC_UFORM
                I_STRUCTURE_NAME         = LV_ZAS_WATER_QLTY_REP
                IS_LAYOUT                = LW_LAYOUT
                IT_FIELDCAT              = G_FIELDCAT_TAB[]
                I_DEFAULT                = GC_X
                I_SAVE                   = LC_A
                IS_VARIANT               = G_VARIANT
                IT_EVENTS                = G_EVENTS_TAB[]
                IT_EVENT_EXIT            = G_EVENT_EXIT_TAB[]
                IS_PRINT                 = G_PRINT
                I_SCREEN_START_COLUMN    = G_SCREEN_START_COLUMN
                I_SCREEN_START_LINE      = G_SCREEN_START_LINE
                I_SCREEN_END_COLUMN      = G_SCREEN_END_COLUMN
                I_SCREEN_END_LINE        = G_SCREEN_END_LINE
           TABLES
                T_OUTTAB                 = GT_OUTPUT
           EXCEPTIONS
                PROGRAM_ERROR            = 1
                OTHERS                   = 2.
    and in the form alv_user_command
    FORM ALV_USER_COMMAND USING UCOMM SELLINE TYPE SLIS_SELFIELD.
    case ucomm.
    Lets hope that the user command of the push button in * PUSH
    when 'PUSH'.
    loop at gt_output where check = 'X'.
    You can write your code here...
    endloop.
    endcase.
    ENDFORM.
    Hope this helps...
    Best Regards,
    Phani.
    Message was edited by:
            Sivapuram Phani Kumar

  • Getting the following message on Final Cut Express "audio only capture selected video preview disabled" how can I get the video capture back?

    I'm getting the following message on screen when attempting to capture video  "audio only capture selected, video preview disabled."  How can I get the view preview back?

    FCE doesn't allow for audio only capture, it's in a twist somewhere.
    Try trashing the FCE preferences.
    Al

  • Check box als column in a standard table, how to get the selected row

    Dear experts,
    I habe standard tablt with check box as column. Now I want to get the current selected row structure and do some changes. How could I solve this problem? till now I just know to get the structure via lead selection.
    lo_node->get_element().
    lo_element = lo_node->get_static_attributes ( static_attributes = ls_row).
    How could I get the element through check-box in stead of lead selection. Many thanks!

    check this code
    To get the selected row number
    data: lr_element type ref to if_wd_context_element,
              lv_index type i.
      lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT'  ).
      lv_index = lr_element->get_index( ).
    Thanks
    Bala Duvvuri

  • When I select a title in the iTunes Store and click on Play in iTunes I am sent to the download page for iTunes 10 which I have already. The selected title cannot be found anywhere in my iTunes. How can I get the title in iTunes with possibility to buy it

    When I select a title in the iTunes Store and click on Play in iTunes I am sent to the download page for iTunes 10 which I have already. The selected title cannot be found anywhere in my iTunes. How can I get the title in iTunes with possibility to buy it?

    The issue is that your credit or debit card credentials must be associated with the same country where you reside in order to purchase iTunes content.
    "Although you can browse the iTunes Store in any country without being signed in, you can only purchase content from the iTunes Store for your own country. This is enforced via the billing address associated with your credit card or other payment method that you use with the iTunes Store, rather than your actual geographic location. You can use the iTunes Store in all countries of which you’re a resident, but you’ll either need a separate iTunes Store account for each one, or you’ll need to continually be switching the billing information on your single account. Generally, it’s simpler just to set up an alternative account for these situations, although it’s worth nothing that features like iTunes in the CLoud and iTunes Match are designed to work best when using a single iTunes Store account, as you can only switch accounts with these services every 90 days."
    From here >  The Complete Guide to Using the iTunes Store | iLounge Article

Maybe you are looking for

  • TextWrap and Anchored Objects

    Okay, I've been using InDesign since it was PageMaker 4.3 so I'm pretty familiar with the features and the intents behind them. Lately I've had a problem for which I can't seem to find a fully acceptable work-around. It involves text-wrapping anchore

  • Dicoverer Viewer is Slow Compared to DiscovererPlus for same query...why ??

    Hi, I have a report whcih runs from a custom table which gets populated daily in the night. It retrieves aroun 98000 records widout parameters. The report runs in around 4-5 seconds in Discoverer Plus wheras in Discoverer Viewer it is taking almost 4

  • How do you Convert CMYK to RGB

    I have a project that I need to convert all of the AI files from CMYK to RGB. This use to be very simple back-in-the-day by just choosing Filter > Convert to RGB. I know about Document Color Mode and Convert to RGB. When I select all of the objects a

  • Is it possible to restore an ipad from icloud backup of an iphone?

    I don't know if this is technically possible.  We have several iOs devices associated with one apple id, an iphone, ipad, and ipod.  I wanted to know if I can delete all the stuff from my ipad and restore it with stuff from the iphone. Thanks for any

  • Mavericks: Clicke twice to log on

    This goes beyond my understanding. After booting I'm presented with 2 icons for 2 user accounts. I have to click my user icon twice to make the password field visible. When I boot in secure mode, I only have to click once. The behaviour during normal