How do I scroll a JTable as the selection cursor moves out-of-view?

If a row is selected in a JTable, and the user navigates up and down using arrow keys, as the selection moves out of view, the table automatically scrolls. In my app, I am programmatically selecting rows, but if the selection is out of view, the table does not scroll. does anyone know how to achieve this? I know I could examine the position of the selected row etc. and scroll the view myself, but this seems clunky. Ideally, I would fire off KeyEvents to get the behaviour for free, but I can't see where to fire them to

I know I could examine the position of the selected row etc. and scroll the view myselfWhy? Thats what the methods where designed for (assuming you are talking about the scrollRectToVisible(...) method).
Ideally, I would fire off KeyEvents to get the behaviour for free,That seems clunky to me.
When you use KeyEvents its a cause / effect relationship. That is first you use a KeyEvent to change selection. Then then if the table is at the bottom it scroll one row. So in you program if you on on row 5 and you want to select row 30, you would need to invoke 25 KeyEvents. Seems pointless to me unless you have special logice that processes every row as it gets selected.
If you want to persue this route then you can just invoke the default actions for the up/ down/ left/ right keys. This posting should give you an idea of how to do this:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=657819

Similar Messages

  • How to get a check box on the selection screen

    Hi all
    can any body tell me how to get a check box on the selection screen

    parameter: pa_check   as checkbox.
    To define the input field of a parameter as a checkbox, you use the following syntax:
    PARAMETERS <p> ...... AS CHECKBOX ......
    Parameter <p> is created with type C and length 1. In this case, you may not use the additions TYPE and LIKE. Valid values for <p> are ' ' and 'X'. These values are assigned to the parameter when the user clicks the checkbox on the selection screen.
    If you use the TYPE addition to refer to a data type in the ABAP Dictionary of type CHAR and length 1 for which 'X' and ' ' are defined as valid values in the domain, the parameter automatically appears as a checkbox on the selection screen.
    REPORT DEMO.
    PARAMETERS: A AS CHECKBOX,
    B AS CHECKBOX DEFAULT 'X'.

  • How do we validate input fields on the selection screen

    How do we validate input fields on the selection screen

    hi balram,
    u can validate input fields using <b>AT SELECTION-SCREEN</b>  Event.
    PARAMETERS : p_werks TYPE marc-werks.
    AT SELECTION-SCREEN ON p_werks.
    SELECT SINGLE *
    FROM t001w
    WHERE werks = p_werks.
    IF sy-subrc <> 0.
    MESSAGE 'Invalid Plant' TYPE 'I'.
    ENDIF.
    Like this, we can validate user input for plant.
    check this link:
    http://help.sap.com/saphelp_nw04s/helpdata/en/9f/db9a2e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
    Reware me if useful......
    Harimanjesh AN

  • How many entries can we put in the select options

    Hi all,
    As per  my requirement I am trying to store the data in the select-option( s_kunnt)  as below
    select kunnr from kna1 into (l_kunnr) where
                and spart in p_spart.
      move 'I'         to s_kunnr-sign.
      move 'BT'        to s_kunnr-option.
      move l_kunnr to s_kunnr-low.
      move l_kunnr  to s_kunnr-high.
      append s_kunnr.
    endselect.
    Using s_kunnr in the select statement to fetch the data.
    When the customer numbers are more than 1800 in the s_kunnr, select statment going to the dump. Is number of entries in the select options are restricted for some count( around 1800)?.
    How many entries can we put in the select options?
    Thanks
    Regards
    Raj.

    Firstly, there is an error in your code. You should do the following instead:
    move 'I' to s_kunnr-sign.
    move 'EQ' to s_kunnr-option.
    move l_kunnr to s_kunnr-low.
    append s_kunnr.
    To answer your original question, the limit depends on the field width you are using in the ranges. If the field width is small, you can have thousands of entries in the range table.
    The limitation is in the length of the SQL statement string generated by the ABAP OPEN SQL engine. With the way I defined it above, the statement would have WHERE KUNNR IN ( 'value1', 'value2', 'value3'). With way you defined it, it would have WHERE KUNNR BETWEEN 'value1' and 'value1' and KUNNR BETWEEN 'value2' and 'value2'.
    When the range table is so large that it results in a short dump, you should look into FOR ALL ENTRIES option of SQL.

  • How to create Drop down menu in the selection screen

    Hi all,
    How to create Drop down menu in the selection screen.
    Fast answer will be highly rewarded
    Regards
    Bikas

    hi ,
    TYPE-POOLS : vrm.
    TABLES:vbak,vbap.
    DATA : v(80) TYPE c.
    DATA: wa_vbak TYPE vbak,
          it_vbak TYPE vbak OCCURS 0 WITH HEADER LINE,
          wa_vbap TYPE vbap,
          it_vbap TYPE vbap OCCURS 0 WITH HEADER LINE.
      DATA: l_name TYPE vrm_id,
            li_list TYPE vrm_values ,
            v_count  TYPE i,
            l_value LIKE LINE OF li_list.
    PARAMETERS: p_test(20) AS LISTBOX VISIBLE LENGTH 60 MODIF ID DAT.
    INITIALIZATION.
    AT SELECTION-SCREEN OUTPUT.
      PERFORM get_data.
      LOOP AT it_vbak.
        l_value-key =  it_vbak-vbeln .
        l_value-text = it_vbak-vbeln .
        APPEND l_value TO li_list.
      ENDLOOP.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = 'P_TEST'
          values          = li_list
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
    AT SELECTION-SCREEN ON P_TEST.
      clear : li_list , li_list[].
      SELECT vbeln
             matnr
             meins
             FROM vbap
             INTO CORRESPONDING FIELDS OF TABLE it_vbap
             WHERE vbeln = p_test.
    START-OF-SELECTION.
      SELECT vbeln
             matnr
             meins
             FROM vbap
             INTO CORRESPONDING FIELDS OF TABLE it_vbap
             WHERE vbeln = p_test.
      LOOP AT it_vbap.
        WRITE :/ it_vbap-vbeln, it_vbap-matnr,it_vbap-meins.
      ENDLOOP.
    *&      Form  get_Data
          text
    -->  p1        text
    <--  p2        text
    FORM get_data .
      SELECT  vbeln
              FROM vbak
              INTO  CORRESPONDING FIELDS OF TABLE it_vbak.
    ENDFORM.                    " get_Data
    regards,
    venkat.

  • How many columns can be used in the SELECT Statment

    Hi all,
    How many columns can be used in the SELECT statement?
    Ex: SELECT x1,x2,....xn FROM <table_name>;
    Thanks,
    GowriShankar.N

    Let me join ;-)
    SQL> select * from v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE    9.2.0.6.0       Production
    TNS for Linux: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    SQL> DECLARE
      2  l_sql varchar2(32000);
      3  begin
      4  l_sql := 'CREATE TABLE T(';
      5  for i in 1..999 loop
      6  l_sql := l_sql ||'C'||i||' NUMBER,
      7  ';
      8  end loop;
      9  l_sql := l_sql||'C1000 NUMBER)';
    10  EXECUTE IMMEDIATE l_sql;
    11  end;
    12  /
    PL/SQL procedure successfully completed.
    SQL> select count(*) from cols where table_name = 'T';
      COUNT(*)
          1000
    SQL> insert into t(c1) values(1);
    1 row created.
    SQL> select *
      2  from t t1,t t2;
            C1         C2         C3         C4         C5         C6         C7         C8         C9       
    ...   snipped
    C991        C992       C993       C994       C995       C996       C997       C998       C999         C1         C2         C3       C4         C5         C6         C7         C8         C9        C10       
    ...   snipped
    C990       C991       C992       C993    C994        C995       C996       C997       C998       C999
    ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------          1
                                                                                                                                        1
    SQL>
    SQL> select count(*) from (
      2  select * from t t1,t t2)
      3  ;
    select * from t t1,t t2)
    ERROR at line 2:
    ORA-01792: maximum number of columns in a table or view is 1000Obviously, inline view is obliged the same restrictions as a view, but select list is not constrained.
    Best regards
    Maxim

  • Urgent: How to exclude a particular value from the selection in the infopac

    How to exclude a particular value from the selection in the infopackage.
    Ex: not load for cost center 10000
    Thank you,
    sam

    Hi Sam,
    You cannot do this directly as exclusion, but you can include all other values, even as ranges and thus exclude the particular value, else you can also try to do this by writing a routine.
    Hope this helps...

  • Can any body tell me how to create a layout variant in the selection

    hi friends i would like to know how to create a layout variant in the selection screen and how to select the variant to display the ouptut using the layout using disvariant.please if possible give me example. thanks in advance.

    hi,
    I shall give you the code. It will definitely work.
    <u><b>Declerations you need to make</b></u>
    data:      WK_VARIANT      LIKE DISVARIANT,
               WX_VARIANT      LIKE DISVARIANT,
               WK_REPID        LIKE SY-REPID,
               WK_VARIANT_SAVE(1) TYPE C,
               WK_EXIT(1) TYPE C.
    <b><u>Things you need to do in the initialization event:</u></b>
    INITIALIZATION.
      PERFORM F_INIT_VARIANT.
      PERFORM F_VARIANT_DEFAULT USING PR_VARI.
    *&      Form  f_init_variant
    FORM F_INIT_VARIANT .
      CLEAR WK_VARIANT.
      WK_REPID = SY-REPID.
      WK_VARIANT-REPORT = WK_REPID.
      WK_VARIANT-USERNAME = SY-UNAME.
      WK_VARIANT_SAVE = 'A'.
    ENDFORM.                    " f_init_variant
    *&      Form  f_variant_default
    FORM F_VARIANT_DEFAULT  USING    P_PR_VARI.
      WX_VARIANT = WK_VARIANT.
      IF NOT P_PR_VARI IS INITIAL.
        WX_VARIANT-VARIANT = P_PR_VARI.
      ENDIF.
      CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
        EXPORTING
          I_SAVE        = WK_VARIANT_SAVE
        CHANGING
          CS_VARIANT    = WX_VARIANT
        EXCEPTIONS
          WRONG_INPUT   = 1
          NOT_FOUND     = 2
          PROGRAM_ERROR = 3
          OTHERS        = 4.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CASE SY-SUBRC.
        WHEN 0.
          P_PR_VARI = WX_VARIANT-VARIANT.
        WHEN 2.
          CLEAR P_PR_VARI.
      ENDCASE.
    ENDFORM.                    " f_variant_default
    <b><u> After this Things you need to do in the At selection screen event:</u></b>
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR PR_VARI.
      PERFORM F_VARIANT_F4 USING PR_VARI.
    *&      Form  f_variant_f4
    FORM F_VARIANT_F4  USING    P_PR_VARI.
      CALL FUNCTION 'LVC_VARIANT_F4'
        EXPORTING
          IS_VARIANT    = WK_VARIANT
          I_SAVE        = WK_VARIANT_SAVE
        IMPORTING
          E_EXIT        = WK_EXIT
          ES_VARIANT    = WX_VARIANT
        EXCEPTIONS
          NOT_FOUND     = 1
          PROGRAM_ERROR = 2
          OTHERS        = 3.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF WK_EXIT IS INITIAL.
        WK_VARIANT-VARIANT = WX_VARIANT-VARIANT.
        P_PR_VARI = WX_VARIANT-VARIANT.
      ENDIF.
    ENDFORM.                    " f_variant_f4
    After this finally when you call the output using REUSE_ALV_GRID_DISPLAY YOU NEED TO mention this parameter in the function module
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          <i><u><b>IS_LAYOUT          = WA_LAYOUT</b></u></i>
          <i><u><b>I_SAVE             = 'X'</b></u></i>
          <u><i>I_DEFAULT          = 'X'</i></u>
          <u><b>IS_VARIANT         = WK_VARIANT</b></u>
        TABLES
          T_OUTTAB           = ITAB1
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.
    Once you do this,,, you can create a layout variant.
    P.S. Mark all helpful answers for points.
    JLN

  • How can i "find my iphone" if the charge has run out so the "lost phone" can't be ONLINE?

    How can I "Find my iphone" if the charge has run out so the phone that is lost can't be ONLINE?

    You can't.  Place it in lost mode and it will be implemented if and when the lost device is recharged by someone and connects to the internet.

  • How To stop the Security Deposited Calculation at the time of move out.

    Hi Guys,
    I am working on this issue from last week still unable to stop the calculation of SD in Final bill at the time of Move out, i have blocked the main and sub transaction, any help will be appreciated as early as possible, this issue has to be solved on weekend.
    Regards
    K. Shilpa

    Hi Shilpa,
    First thing I will say that if you reverse an actual payment from customer's account, there are many impacts on the customer side and on SAP side. I think you have already taken care all these things.
    Now for the first point if you want the open SD will not appear in the print document, you can do it by reversing the security deposit or by invoicing printing configuration. For the first option you can go to change security deposit (FPSEC2) and reverse it. To do this all the SD documents should be in open status.
    For the second option you can go to the following menu path:
    SPRO-SAP Utilities-Invoicing-Invoice Processing-Item Selection in Invoicing-Item Selection in Account Maintenance/ Define Sub-Items
    In the above menu path for clearing type R4 (Invoicing) and periodic billing (R41),  you can control the items which will be printed in the invoice. Select the clearing type and click on the 'Item selection on bill print out' on the left hand side. For the clearing category (maintained at contract account level) you can maintain the main and sub transaction of security deposit (might be 0020 / 0020) and you can see a field 'IP' (Item Will Be Printed on the Bill) where you should maintain it blank. If you do that, security deposit will not be picked up in the invoice document. However it will remain open in the account if you just stop the printing of SD and keep it in the account.
    However it totally depnds on the business requirement and related implications whether you want to reverse the SD or you want to keep this in account and do not want to show them on the bill.
    Now for the second point you have mentioned, you need to first decide what you will do with the SD payments made by customer.
    Either you can release the SD amount and refund it to customer or the amount can be adjusted with the next invoice. Again it depends on business requirement whether you will refund any payment made against SD or you will simply reverse all open security deposits.
    Also if you want to stop the SD creation process now onwards, you need to revert all SD configuration like main / sub transaction configuration for SD, default SD releted settings etc. There is no standard process for it. If you want to reverse the SD, you can write a custom program. The configuration related things need to be done manually.
    Since all the things will impact the business process or customer, I hope you will take care those things before coming to a conclusion.
    Thanks.
    Nirmalya

  • I can't delete in the search/address bar on my cursor moves out of the box

    When I try to delete after typing a word in the search bar after the cursor moves out of the box I can't i have to reload the page before i can start typing again. Also happens when i just click off the box does not let me type any more without refreshing. I get a beep sound when i try to type or reload

    Clear Safari and the reset the iPad again. Settings>Safari>Clear history and website data. Now reset the iPad by holding down on the sleep and home buttons at the same time until the Apple logo appears on the screen.
    I would also reset the router by unplugging it for 30 seconds and then plug it in again.

  • Why does the mouse cursor move to away from the currrent application without the mouse being moved

    the mouse cursor moves away from the current application without the mouse having been moved - this started with the new version - re-installing Firefox makes the problem go away for a short period - re-installing is not a solution
    == This happened ==
    Every time Firefox opened
    == a few days after installing 3.6.3

    Hello Jim.
    It's probably one of three things:
    #your mouse is getting old (this behavior is common in old optical mouses);
    #you have software that is making your mouse cursor behave unexpectedly (I know of an option in Windows that will automatically move your mouse to windows buttons...);
    #or you may be having a problem with some extension or plugin that is hindering your Firefox's normal behavior. Have you tried disabling all add-ons (just to check), to see if Firefox goes back to normal?

  • How to create a report based on the selection of a node of a tree

    Hello,
    I am new to Oracle Apex and I was trying to build a tree and also an interactive report based on the empno column of the emp table.
    I have created a tree based on emp table. Now I want to display records of the employee selected in the tree.
    Here is the tree query:
    select case when connect_by_isleaf = 1 then 0
    when level = 1 then 1
    else -1
    end as status,
    level,
    "ENAME" as title,
    null as icon,
    "EMPNO" as value,
    null as tooltip,
    null as link
    from "#OWNER#"."EMP"
    start with "MGR" is null
    connect by prior "EMPNO" = "MGR"
    order siblings by "ENAME"
    Can anyone tell me step by step how to go from here?
    I tried to follow the thread Re: tree question but could not understand much from it.

    The approach for reloading the page and displaying the report is quite simple.
    <li>You start by creating a new page item which would be used to store the selected node ID , eg. P100_SELECTED_NODE (you can make it atext item and change it hidden once everything works as expected)
    <li>Modify the tree query and change the link column in the tree definition SQL query to a link to the same
    for example if your page is 100 , you would make the tree node link to the same page but set the P100SELECTED_NODE with selected node's id_
    This done here
    {message:id=4410987}
    In this case it would be
    'f?p=&APP_ID.:100:'||:APP_SESSION||'::::P100_SELECTED_NODE:'||EMPNO as link Now when you click on a tree node link , it would come back to the same page, but set the P100_SELECTED_NODE with the empno of the clicked node.
    <li> All that is left to do, is changing your Report so that it refers to the new item inorder to filter the records for this employee i.e empno
    SELECT ...
    WHERE empno= :P100_SELECTED_NODE

  • How to use a table name in the select statement using a variable?

    Hi Everybody,
                       I got a internal table which has a field or a variable that gets me some tables names. Now I need to retrieve the data from all these tables in that field dynamically at runtime. So could you suggest me a way out to use the select query which uses this variable as a table ?
    Regards,
    Mallik.

    Hi all,
    Actually i need some more clarification. How to use the same select statement, if i've to use the tabname in the where clause too?
    for ex : select * from (tab_name) where....?
    Can we do inner join on such select statements? If so how?
    Thanks & Regards,
    Mallik.

  • How to give dynamic file path in the selection  screen

    Hi All,
    How to give dynamic file path f4 functionality to user on the selection so that he can browse for the path in the presentation serve? I believe there is one fun module is there for this purpose I am not getting that
    Please help me in this regard.
    Thanks&Regards
    Mahesh

    HI,
    check this program.
    <b>report ZWA_TEST2.
    PARAMETERS: a(100) default 'PRESS F4'.
    data: filet type table of FILE_TABLE.
    data: wa type file_table.
    data: count type i.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR a.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      CHANGING
        FILE_TABLE              = filet
        RC                      = count .
    loop at filet into wa.
      a = wa-FILENAME.
    endloop.</b>
    Regards,
    HRA

Maybe you are looking for

  • File name and path should be passed as parameter

    hi all, i am writing a set of statements into the text file. But i have to pass the file name and also path as a user enterable parameter. please suggest me to proceed further. for ex: i am storing it as output:=text_io.fopen(c:abc\def\out.txt','w');

  • Cropping the top of photos off

    Hi, Lightroom is cropping the top of my photos off. I'm new at this still and I don't know how to fix it. The photo looks fine in Preview, so I'm at a loss. What did I do, and how can I fix this?

  • SMS character limit

    How do you know if you've gone into 2 or more SMS's? Is there not a warning telling you if you've gone over the character limit?

  • How to obtain aggregate results using ODBC?

    How do I obtain results of an aggreate functions like SUM etc? I have an MFC application that uses CRecordset. Following is the code snip: CDatabase db1; o1 db; // class that is a sub class of CRecordset and makes a connection to the Oracle // databa

  • DEBMAS with only part of contact persons?

    Hi there, if we send in a DEBMAS IDoc that contains only a subset of contact persons of a customer, the inbound process will remove all other contact records from KNVK. We tried different MSGFN values, without success. Is there any way we could send