ScrollRectToVisible still scroll to the previous one

Hi,
I tried to get my selected row be visible, but the selected row is always lie one row under the last row of the viewport. I tried alot of solutions from the forum, but still got stuck. Can anyone help me with this.
Here is my code:
// this is the code from my constructor
FPTable = new JTable();
FPTable.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
lsmodel = FPTable.getSelectionModel();
lsmodel.addListSelectionListener( this );
scroll = new JScrollPane( FPTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
scroll.getViewport().add( FPTable );
tablePane.setLayout( new BorderLayout() );
tablePane.add( scroll, BorderLayout.CENTER );
tablePane.setBounds( 12, 135, 1107, 426 );
add( tablePane );
populateTable(); // this populate the data from my db contains about 1800 records.
setCurrentRow( 400 ) // 400 is row index
// this is my setCurrentRow(int) method
public void setCurrentRow( int row )
-----// dm is my datamodel
if( row >= dm.getRowCount() || row < 0 ) { row = 0; }
if( dm.getRowCount() != 0 )
FPTable.setRowSelectionInterval( row, row );
r = FPTable.getCellRect( FPTable.getSelectedRow() , 0, true );
if( !FPTable.getVisibleRect().contains( r ) )
----- FPTable.scrollRectToVisible( r );
I have tried to substract the row index by 1 ---> still doesn't work
Please help me, i got stuck for couple days already. I need to get this done asap, because they're waiting for me to release the project.
Thanks in advance

hi deeps,
Thanks for your reply. I tried this, it works. However, while the process is running, it looks like the default JTable column's size is called, then my setCurrentRow next, then my column resize method got called. I have the method to set the rolumn's size. The screen looks like it's jittering (dancing around). After I tested for couple of times, my table is scratched.
Can you tell me why?
Thanks.

Similar Messages

  • HT201250 What happened if a new backup has erased the previous one, can I still recover my files?

    What happened if a new backup has erased the previous one, can I still recover my files?

    Welcome to the Apple Support Communities
    Time Machine doesn't erase old backups. That's only done when your Time Machine disk or Time Capsule gets full.
    If you want to mean that you have connected the Time Capsule to another Mac to create another Time Machine backup, you should know that the old backup isn't modified, and you can still restore files from that old backup > http://pondini.org/TM/E3.html

  • Prohibiting running a new package while the previous one is still running

    Hi Colleagues,
    I'm looking for a way to prohibit a new package running while the previous one is still working. Is it possible to make a sequence of "to be run" packages, when the next one starts right when the previous one finishes?
    Or maybe just prohibit starting a new package while the some package is already running.
    Thank you.
    Best regards,
    Sergey

    Hi Sergey
    If you want to restrict the concurrent execution of data manager packages, you will have to edit your data manager package and add custom code.
    For example:
    You could put in queue based logic, when the package is first run, it inserts a record into a 'Queue' table, then once it completes the execution of its tasks, it deletes the record from the queue table.
    So, if anybody runs the same data manager package, it checks to see if the record exists in the queue table, if it does, it ends the execution of the package.
    I hope this helps
    Kind Regards
    Daniel

  • But how do I create a new iTunes backup password without knowing the previous one?

    In case anyone keeps track of such things, I'm among those folks who really doesn't recall ever being asked to create an iTunes backup password, but that's irrelevant to my question.
    I'm not in any bind. I don't need my backup files to restore anything. I will shed no tears as they are moved to the Recycle Bin (indeed, I will gladly do the deed myself).
    That said, it appears impossible to create a new backup password without knowing the previous one.
    If the only "solution" is to wipe my iPhone's memory and start from scratch, I will be a sad camper.
    Any help? Are backups to iCloud encrypted?
    Cheers...

    Additionally:
    Be super critical & meticulous (and whatever other synonym I missed) when you get a new password:
    Write it onto your bedroom wall, or someplace off of a computer that you will always find.
    If you active 2-step verification, the key is VERY important. Lose it & you may be toast.
    If you don’t 2 step verify, & use the Security Question instead --> do not lose, or forget the answers.
    Very nearly the same outcome!!!!!:  Bad experience.
    If you add a 2nd email address, make sure its a RESCUE address not just an alternate address.
    If you lose these, you lose access to your 3rd party purchases via Appstore for future upgrade. That will make you VEWY, VEWY UNHAPPY. Apple new OS versions do update, but add a new device & likely you will be unable to use your content on that device. It will never load if the ID locks up.

  • HT204053 I created a new apple id because the previous one no longer exists as email (domain had to be cancelled). I keep seeing the old one pop up in my iPhone for which I don't remember the password. How can I get rid of it???

    I created a new apple id because the previous one no longer exists as an email (domain had to be cancelled). I keep seeing the old one pop up in my iPhone for which I don't remember the password. How can I get rid of it??? Or how can I reset the password if the email doesn't exist??? I also tried answering a question (my date of birth) but it says it's wrong.
    I'm really frustrated with the apple id!!!
    Frustrated!!!

    In one of the help pages for managing your Apple ID (http://support.apple.com/kb/HE40), it shows two separate sections, one for Apple ID and one for Primary Email address. When I go to manage my Apple ID, I see only a single section for both. Can the two be 'separated', especially when you face the situation of having to discontinue your email address for some reason?
    I also noticed that when navigating to Apple ID Support Communities, it shows my nickname 'dishdy'. How and when did I insert this? In the current sequence for creating an Apple ID I don't see this. In my current profile I don't see this.
    In any case, I have freed myself from my previous Apple ID (@artemis.it) on my iPhone.
    Thanks for your help.

  • I just updated my latest java but the update is causing problems with some externale devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device

    i just updated my latest java but the update is causing problems with some external devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device.
    Is this possible and how do i do that?
    Anyone who responds thanks for that!
    Juko
    I am running
    Hardware Overview:
      Model Name:          Mac Pro
      Model Identifier:          MacPro1,1
      Processor Name:          Dual-Core Intel Xeon
      Processor Speed:          2,66 GHz
      Number of Processors:          2
      Total Number of Cores:          4
      L2 Cache (per Processor):          4 MB
      Memory:          6 GB
      Bus Speed:          1,33 GHz
      Boot ROM Version:          MP11.005D.B00
      SMC Version (system):          1.7f10
      Serial Number (system):          CK7XXXXXXGP
      Hardware UUID:          00000000-0000-1000-8000-0017F20F82F0
    System Software Overview:
      System Version:          Mac OS X 10.7.5 (11G63)
      Kernel Version:          Darwin 11.4.2
      Boot Volume:          Macintosh HD(2)
      Boot Mode:          Normal
      Computer Name:          Mac Pro van Juko de Vries
      User Name:          Juko de Vries (jukodevries)
      Secure Virtual Memory:          Enabled
      64-bit Kernel and Extensions:          No
      Time since boot:          11 days 20:39
    Message was edited by Host

    Java 6 you can't as Apple maintains it, and Java 7 you could if you uninstall it and Oracle provides the earlier version which they likely won't his last update fixed 37 remote exploits.
    Java broken some software here and there, all you'll have to do is wait for a update from the other parties.

  • TS2776 I cannot get my IPhone to recognize my new computer; it's still looking for the old one.

    My IPhone won't sync with a new windows 8 computer.  It's still looking for the old one.  How in the he11 do you change the name of the PC the IPhone looks for?

    This user tip should be useful
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive

  • HT4623 How can I get rid of this new update and go back to the previous one and how can I register a complaint with Apple?

    How can I get rid of this new 7.0.2 update and go back to the previous one and how can I register a complaint with Apple?

    You can't go back.
    You can leave feedback: http://www.apple.com/feedback

  • Overlap audio regions on 1 track without cutting the previous one off

    Im trying to overlap multiple audio regions on one track, so that the next one starts before the previous one ends but when i do this, each consecutive overlap basically replaces the remaining region of the one before it. to be more specific in order to maybe paint a better picture of what i am asking... i am creating machine gun audio for a video clip and i have a loop of a single shot plus the shell falling to the ground. im trying to overlap the loops so that the single shot of each come together in rapid fire succession to create the machine gun firing sound, but i want the sound of the shell falling for each shot to continue to play under the multiple copies of the overlapping loop. the problem is, when i overlap multiple loops, its not finishing the noise of the shell falling to the ground for each shot, it only plays the falling shell at the very end when there is no other overlap. i hope i did an ok job explaining what i am asking, haha trying to type this out was much more difficult that initially anticipated. thanks in advance for any help.

    That's normal. Audio tracks are not polyphonic. Use several tracks or EXS24.
    Christian

  • When i visit a web page then log out...when i open firefox to visit another webpage, the previous one loads automatically. Why? How do I turn this off?

    When I visit a website, close Firefox, then reopen Firefox to go to another website, the previous one loads automatically. Why? How do I turn this off?

    Change the startup setting:
    Tools > Options > General > Startup: "When Firefox Starts": "Show my home page" or "Show a blank page"

  • Personal Domain changed but iWeb still remains with the old one

    Hi,
    recently I changed my Personal Domain on MobileMe. Unfortunately iWeb still remains with the old one: Even if I create a new iWeb-Domain the problem occurs. I also checked whether this is a local iMac problem or not but it isn´t unless I have the same issue with my MacBook Air using the same MobileMe Account. Every time I open iWeb the 'Settings Page' shows the old personal domain name (displayed in brackets behind the MobilMe Account information). At MobilMe the new Personal Domain name displayed as the active one.
    Any Ideas?
    Thanks in advance
    Mikl

    I have this same problem.. Any help would be appreciated!!!

  • Is the new iphone a much better upgrade to the previous one?

    Well i was hoping to go to my local cellular retailer to check out the new phone, but they havent display it out yet. Just wondering for those of you who got one today, how are you liking it? Is it really worth the upgrade from the previous one?
    How is the video recording? Is it smooth and clear?

    Yes NFSUndercover and Sims 3 run way smoother. No crashing every so often in the Sims either.
    I knew it felt 2x faster immediately, because when you open and close any apps (even texting and such), it is silky smooth with NO hiccup. My 3G felt a bit sluggish, and the games could slow down every so often. 3GS is what the 3G should have been

  • Traversing from one screen to the previous one using back button

    Hi all,
            I am new to the forum and want the help of the experts over ther for this doubt i encountered. I want to know how we can traverse from one screen to the  previous one using the back button. Like if presently i am in 4th screen if i want to go back directly to the 2nd one then how to do that.
            Kindly help me by clarifying this doubt.
    Thanks

    Hi Jana,
    If u r using the screen painter then u need to create  a button and in status there.code as set pf-status.
    case sy-ucomm.
    when 'back'.
    leave to screen <screen number> here if u want to go to the other screen i.e to screen 200 ffrm 400 then u can code it as
    leave to screen 400.
    or else code it as
    if screen = '200'.
    leave to screen 400.
    try this eg it might work ..
    regards,
    sana.
    reward points for helpful answers.

  • Salary in the current month and  the previous one

    Hi
    I have a table that stores payroll details like the following stracture
    earn code
    period from
    period to
    user_id
    time
    I want to do one report which displays both the salary of one employee in the current month and his salary is the previous one
    Thank you for your help

    you might use the LAG-function to get the previous months salary. Hard to know, as you did not provide any information about your report and database versions.

  • I import photos into lightroom and they appear just fine and then after 'developing' some disappear from the library though they still exist in the previous import window

    I import photos into lightroom and they appear just fine and then after 'developing' some disappear from the library though they still exist in the previous import window

    Running MacOS 10.9.4 16 Gb RAM Lightroom v5.2

Maybe you are looking for

  • BootCamp made for Windows Vista would not install in WIndows 7

    Hi, I am trying to install Bootcamp drivers on Windows 7 with the Mac OS CD that came with my Intel-based iMac. The problem is that I bought my iMac when the latest Windows was Vista, and it would not install on Windows 7. The Bootcamp drivers for Wi

  • New TM user: initial back-up plan

    Hi. I'm going to be using TM for the first time to back up my son's Digital Performer music project files. He keeps all of these files, which are very large, on a 1Tbyte internal drive called "Projects," which is separate from his main Mac HD. My pla

  • Sap best practices - payroll international

    hello experts, Pls forward me the path of SAP Best Practices for international payroll or mail me [email protected] it is very urgent...... thanks ram

  • Crop Against subject, removing background?

    I need to paste this column on a colored background, but the rectangular border of the canvas around the column is white, so the pasted overlay shows a white rectangle instead of just the column.  How do I remove the rectangular background, so that I

  • FCE 4 Froze At The End Of VHS Capture Through DAC-100.

    I spent a large part of yesterday copying a 2 hour VHS tape to FCE 4 via my DAC-100. At the end of the 2 hours I pressed the esc key only to hear a warning "thud" bleep and find that FCE had suddenly frozen. After I force-quit I found the 25GB file w