To put a row selected by a number as the first in a JTable

Hello,
I have a JTable that is in a scroll pane and I try to get a row that is identifyed by a number how the first in the JTable.
I use this function to have the required behavior:
public void scrollToSelectedRow(int rowNmbr){
        int rowHeigth = agendaTab.getRowHeight();
        JScrollBar sb = jScrollPanCalendSupporter.getVerticalScrollBar();
        sb.setValue(rowHeigth * rowNmbr); // rowNmbr
    } // scrollToSelectedRow()The application where I will use the function concern with an scheduled time that can vary ewery
day in the week (and the times are put in the Jtable).
So, some time the JTable can have 3 rows, other time it can have 10 or 40 or 0 too...
In a simple test, the function that I use works fine, but when I use the function in the application
I have problems: not every time the indicated row become the first in the JTable ..
Debugging the code I saw that the the value that I get by this statement:
int max = jScrollPanCalendSupporter.getVerticalScrollBar().getMaximum();is different in the thest program from appliacation program, so I have a clue about what the
mistake could be...
I have tried to regulate the behavior of the scoll pane before to call the function,
trying to have the right value for the "max" variable, by calling repaint() but I didn't get any good
result with this solution...
I should like to have some suggestion about how I could have a right value for the variable max
.....hoping this could be the cause of the mistake...
Otherwise ever other suggestion is welcome to fix the problem...
thank you
regards
tonyMrsangelo

Use the following method instead:
table.getCellRect(...)
table.scrollRectToVisible(...);

Similar Messages

  • How can I remove the page number from the first page of the document that is the cover page?

    How can I remove the page number from the first page of the document that is the cover page?

    If you open the Pages panel, (Window>Pages) you will see thumbnails of your master pages and your document pages. In new documents, there is usually a master called A-Master and one called None. If you drag the thumbnail of the None master onto the thumbnail of a document page, it will apply that master to that page. Presumably, you have made your page numbers on A-Master, so this will usually do the trick. If you have elements on A-Master that you need on the first page, but just not the page number, you can duplicate A-Master (which, by default will give you B-Master, but you can change the names if you like) and remove the page number on the duplicate and apply that to the document page.
    It might also be worth noting that you can apply master pages in the fly-out of the Pages panel. Go to the fly-out triangle and go down to Apply Master to Pages…, then select a master to apply and the range of pages (1-8 will give you all 8, 1, 3, 5, 7 will be the odds, 1-3, 4, 6-8 if you want continuous ranges and individual pages).

  • How do you number pages but start the numbering on the second page, while omitting the page number from the first page (my title page)

    I have recently changed from Word to Pages 5.5. I want to create a document with a title page (no number) and the second page as Page 1. It is quite simple to do in Word, but I cannot find a way to do it in Pages.

    Hi Ryanlipp;
    Insert a section break
    Place cursor in the newly created section (page)
         In the Document panel:
    select Insert page number: 1.
    Under Numbering, select start at: 1
                     It starts numbering from number 1 in the new page (2nd page).
    Now place the cursor in the previous page (Ist page).
    Select Hide on first page section.
                     This hides page number in the first page of the document.
    I hope, this is what you are after.
    Regards,

  • Not allowing a number as the first char in the username

    Is there a particular reason why I am not allowed to create a username with a number
    as the first character? Or is this something that can be changed? If so, how
    can I go about changing it? I have edited the UsermgmtTools.properties to say:
    "disallowFirstCharDigit: false", instead of true... and rebooted the portal, but
    it did not seem to make a difference. Any help in this would be greatly appreciated.
    Thanks

    Oh, I failed to change the field type to "text" in the insert
    record dialogue box as well.

  • How can I send a second msg to a stolen ipad?  I didn't leave my phone number in the first msg.

    How can I send a second msg to a stolen ipad?  I didn't leave my phone number in the first msg.

    Same way you sent the first one.
    Log into iCloud.com or FIndMyiPhone and send a message.

  • When I select an album to play the first song gets listed many many times on upnext and is the onyl one to play..help

    When I select an album to play the first song gets listed many many times on upnext and is the only one to play..help

    Figured it out.. Had the repeat set to 1...so it lists the first song multiple times....

  • RDL report(2008).Want to display different number of rows from second page onwards than the first page.

    I have used pagination to display the report data.I have used page break.I want to display 10 records on first page and from second page onwards I want to display 25 records on all remaining pages.
    I followed this link to show 25 records for all page. "http://www.sqlchick.com/entries/2010/9/11/displaying-fixed-number-of-rows-per-ssrs-report-page.html". Now suggest me how display 10 records only on first page having 25 from second page onwards.

    Hi mukesh_harkhani,
    According to your description, you want to insert page break for different number of rows, display 10 rows on the first page and 25 rows on the following pages. After testing the issue in my SQL Server Reporting Services 2008 environment, we can use the
    method below to achieve your requirement:
    In your scenario, right-click the group which contains the expression: =CEILING(RowNumber(Nothing)/25) to open the Group Properties dialog box.
    Modify the original expression to the following in the Group on textbox:
    =Floor((RowNumber(Nothing)+14)/25)
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Row selection in Table should be the same, if we came back to the page?

    Hello All,
    I am using JDeveloper 11g.
    I created one adf Table on jsp(empPage) page and selected one row(single selection) , than user can move to other page(to finish some other task), after coming back to the earlier page(empPage), row selection should be the same.
    Can you please help me?
    --Neelmani Jaiswal
    Edited by: Neelmani Jaiswal on Jan 11, 2009 12:09 PM
    Edited by: Neelmani Jaiswal on Jan 11, 2009 12:10 PM

    check this post here. I still have the same issue.
    Code for getting the selected row in ADF Table 11G prod

  • My texts are sendin from my email not my phone number and I can't select my phone number only the email button

    It will not allow to select my mobile number to send an revive message only lets me select the email

    Go to Settings/Messages and log out. Do the same for Settings/FaceTime. Then go here: https://selfsolve.apple.com/deregister-imessage and deregister the old number. Finally, log back in to Settings/Messages and FaceTime.

  • Bin Number for the First Time Putaway

    Hi,
    At the time of warehouse management go-live, we move tne stock from non-wm stock to wm-stock via tcode MB1B/311, then the system create transfer orders with proposed bin number according to the settings and material master data.
    The problem is, for some materials which are not set as "Fix Bin" in the material master, the bin number proposed by the system  are not as same as actual ones when we put away the materials at the first time.
    So, after WM go-live, what's the best way to keep the actual bin number for each material consistent with actual ones, is there any good ways except stocktaking?
    Kindly please advise.
    Thanks.

    Hi, Jürgen,
    Thanks a lot.
    If so, is it OK to do as follows?
    suppose I will acticate warehouse management for the following storage location:
    Plant: P001
    Storage location: SL01
    1) to keep the original stock in the storage location SL01, do not move the stock out to non-WM managed storage location before go alive.
    2) transport the WM settings to production system
    3) because the warehouse was managed via an external (third-party) warehouse management system before, so I have a detailed  list including  material, exact bin number and quantity.
    So I create transfer orders  with movement type 561 according to above list, and this can make the WM stock consistent with IM stock. is it OK to do like this?
    Kindly please advise again.
    Thanks.

  • ExportCollectionAction causes current rows values to be copied in the first row of the table

    Greetings experts,
    I use JDev 11.1.2.3
    I'm facing a really strange behavior of the exportCollectionActionListener. I have a table, and for each row of this table, a link, which calls a popUp. This popUp shows the history of this selected record changes (means it displays the data from another table/VO, which keeps the history of the first one) in a table. I have a button which calls the exportCollection for this second table. When i press it, an excel file is generated and downloaded, and that's all fine untill now. If there wasn't any record in this table, and o go back to the first one, pressing the submit button doesn't track any changes. But if there where any records in that history table (always talking about the history of the current row) , get back to the first one and press Submit, than the very first row of the firs table, gets all it's values set as the last row of the second table, as it is copied from one to the other. I have to press Rollback to get it back into normal ( note that the popUp has it's CancelListener invoke a Rollback operation from a backing bean).
    Why is this happening?
    Thanks in advance

    Hi Frank,
    Well, that's it. No code is involved in this process, that's why i'm asking here. The only code invoked in here is that of the CancelListener of the popUp, and i've inserted it because of this problem, but it didn't resolve anything.
    As per other code, i have another button which invokes code to generate and download a Jasper Report, in Pdf format. This has nothing to do with the exportCollection. Different buttons, different beans containing obviously different code. Further more, this behavior doesn't happen when i download the pdf (press the other button)
    As per the popUp, there is just a link in each row of the main table, which has a showPopUpBehavior, which calls this popUp, containing the second table.
    Note: if i download the pdf or do not do any operation with the popUp (i.e. just close it after it is opened) that behavior doesn't occur.
    This is the source of the popUp, i've just removed the columns as it would take too much space in here:
    <af:popup childCreation="deferred" id="p2"
                                              contentDelivery="lazyUncached"
                                              popupCanceledListener="#{popUp.adminPanelCancelListener}">
                                        <af:dialog id="d3" type="none">
                                            <f:facet name="buttonBar">
                                                <af:panelGroupLayout id="pgl7" halign="end" styleClass="AFStretchWidth"
                                                                     layout="horizontal">
                                                    <af:commandLink text="Download Excel" id="cl18">
                                                        <af:exportCollectionActionListener type="excelHTML" exportedId="t3"
                                                                                           filename="User history.xls"
                                                                                           title="User history"/>
                                                    </af:commandLink>
                                                    <af:commandLink text="Download Pdf" id="cl3">
                                                        <af:fileDownloadActionListener method="#{reportBean.downloadUserHistory}"/>
                                                    </af:commandLink>
                                                </af:panelGroupLayout>
                                            </f:facet>
                                            <af:table value="#{bindings.UsersHistory1.collectionModel}" var="row"
                                                      rows="#{bindings.UsersHistory1.rangeSize}"
                                                      emptyText="#{bindings.UsersHistory1.viewable ? 'No data to display.' : 'Access Denied.'}"
                                                      fetchSize="#{bindings.UsersHistory1.rangeSize}" rowBandingInterval="0"
                                                      selectedRowKeys="#{bindings.UsersHistory1.collectionModel.selectedRow}"
                                                      selectionListener="#{bindings.UsersHistory1.collectionModel.makeCurrent}"
                                                      rowSelection="single" id="t3" width="800px"
                                                      columnStretching="column:c10" styleClass="AFStretchWidth">
                                            </af:table>
                                        </af:dialog>
                                    </af:popup>

  • Displaying the sorted acct number as the first element

    Hi,
    I have list of account numbers , say 5 account numbers (2300,5200,7689,1234,4566) from which I found which is the parent acct number by invoking a query. Here the parent acct number is say "1234". Now i need to make sure that parent acct number records should always display at the top part of the screen followed by other child acct numbers displayed in ascending order. Here my question is, having found the parent acct no (1234) , how I can make sure this will be displayed at the top. Because the final list contains other acct numbers as well. Using comparator is a pbm. as i cannot pass the parent acct no to the compare() method to display this at the top. I want to do this in a single final list itself which contains all the acct number details. How to go about this? Please shed some light into this.
    Thanks.
    JavaCrazy

    Re: Sorting the respective account number at the top
    What happened to this thread?

  • How to highlight selected tab instead of getting the first tab by defaultly

    Hi All ,
    I had one problem with the Jquery accordian. When I am selecting one tab in Jquery accordian then that tab is not getting highlited.
    By defaultly the first tab is getting highlited or selected. The page for that selected tab is opening but the tab is not opening. By defaultly the first tab in accordian is getting selected.
    Can some one help me on this.
    Thanks & Regards,
    P.Mohan Reddy

    My question is like when we click on the first tab in the accordian then that page will open and in the accordian the 1st tab will be opened and other tabs r closed in the jquery accordian. But in the same way when i am selecting the 2nd tab or other tabs in the accordian then that particular tab is not opening even in that case also the 1st tab is opening and the selected tab is not opening.

  • I bought my photoshop elements 10 box from Costco and I entered in the serial number for the first disk. Then, I removed the disk and put in the second one. I entered it in again, but it said that it was an invalid number. It worked on the first disk, but

    It keeps saying that it is invalid for the second disk, but the first disk worked fine!

    See if this sheds any light:
    FAQ: Installing Elements 10, or What do all these disks do?

  • Can u find (number of rows) + (SELECT * FROM emp) in 1 query?

    We have a requirement like this: We need to pass a SQL statement as a SYS_REFCURSOR OUT variable from a SP. Problem is, if the SQL returned 0 rows we have to send 1 row with all NULLS to the SYS_REFCURSOR.
    Is there any way to find out the number of rows returned from a SQL without having to put a SELECT COUNT(*) again using the "same" SQL?

    Peter:
    That only works if the cursor actually returns rows. Consider:
    SQL> create table t as
      2  select rownum id, to_char(to_date(rownum, 'J'), 'Jsp') descr
      3  from user_objects
      4  where rownum <= 5;
    Table created.
    SQL> insert into t select * from t;
    5 rows created.
    SQL> commit;
    Commit complete.
    SQL> create function f (p_id in number) return sys_refcursor as
      2     l_cur sys_refcursor;
      3  begin
      4     open l_cur for
      5        select id, descr, count(*) over() cnt
      6        from t
      7        where id = p_id;
      8     return l_cur;
      9  end;
    10  /
    Function created.
    SQL> var cur refcursor
    SQL> exec :cur := f(1);
    PL/SQL procedure successfully completed.
    SQL> print cur
            ID DESCR             CNT
             1 One                 2
             1 One                 2
    SQL> exec :cur := f(42);
    PL/SQL procedure successfully completed.
    SQL> print cur
    no rows selectedSince the OP's requirement (or ""solution" coming from someone who misunderstood the concept of cursors") is that "if the SQL returned 0 rows we have to send 1 row with all NULLS to the SYS_REFCURSOR" the analytic count doesn't help.
    @OP
    The only reliable (for certain definitions of reliable) way would be to consume the first row of the cursor to see if it did in fact return any rows.
    However, if the cursor was initally empty, we then need to generate a new cursor with all NULLS to satisfy the request. Not a big deal, as the new cursor would reflect the state of the database at the time of the initial query, even if a qualifying row was inserted and committed between the first query and the second, but it doesn't work the other way around.
    If I consume the first row and find a record, then I need to re-do the query to get all of the rows. but what happens if another process changes/deletes the qualifying row in between and commits? The second query will have no rows and you will return an empty cursor to the caller.
    Also, counting the rows (which the analytic count will need to do) could have a significant impact on performance since all the qualifying rows need to be read before the first row can be returned.
    John

Maybe you are looking for

  • Material data in document tab of BOM

    Dear All, Whenever I am entering a component in the BOM the same BOM is getting copied in the document tab of the BOM.with the same quantity. Can anyone tell me where the settings will be wrong.Why is this happening and where shud the changes be carr

  • I just upgraded to OS x and now Logic 9 is not supported...

    Logic 9 is not working with the new OS X (10.9). Is there an upgrade for logic or does everyone have to buy the new one?

  • Can I use Flash with Flash catalyst?

    I was wondering, since Flash Catalyst apparently only uses "rudimentary animation", can I use Flash Professional with Flash catalyst? I would like to do more complex animations, and I was wondering if there was a way to import those animations into F

  • Render Video with  Nvidia Gefore GTX 860m

    Is there a way to render video with my Nvidia Gefore GTX 860m graphics card in Premire Pro CS6? It's not on the list, and the option is grayed out.

  • Planning BoM in PP

    What is Planning BoM and how it is created?