JScrollPane not scrolling to the end of JTable

Hello,
I put a table in a scroll pane, and add the scroll pane to a panel. The problem is the scroll pane does not scroll to the end of the table, it always lets me view only the first 37 rows of the table, regardless of how many rows the table actually has. Basically, the scroll pane thinks the table has exactly the same height, no matter how many lines it has. Why is this happening?
The code is something like
model = new SearchResultTableModel(false, null, null);
table = new ResultTable(model);
scrollPane = new JScrollPane(table);
mainBox.add(scrollPane);
If this is important, the table is a bit more complicated, I subclass JTable, use a custom TableModel, several types of cell renderers / editors, so maybe this is why it behaves so strange. How could I tell the scroll pane the table is actually larger?
Thank you very much, any ideas are highly appreciated,
Regards from Romania,
Adi

Hi,
fireTableDataChanged() is the easiest way to do it, but also that one, that forces JTable to rerender all visible cells, regardless the fact, that they are already displayed and would not need rerendering - if you add a row - for example row 7 - do fireTableRowsInserted(7,7); instead - so JTable will only render this single row if it is visible in the viewport. If you add a couple of rows, for example row 7 to 227, do fireTableRowsInserted(7,227); - always fire only the correct notifications accordingly to the changes you make, in order to keep the performance of JTable high.
greetings Marsian

Similar Messages

  • JScrollPane Must Scroll to the END ........

    My problem is :
    I have a JTextArea , and the text inside doesn't fit
    in it. When this happens , the two ScrollBar should
    scroll to the END of the text....
    Like if a have a JTextArea with 10 rows with a JScrollPane, and my text is 20 rows long, then i
    need to see the end of the text(No manual Scrolling)
    Are there any method to control the Scrollbar position ?
    Help....!!!!!!!

    Hi,
    When you move the caret position of your JTextArea, then the scollbars follow. Try this (assuming your JTextArea is called textArea):
    textArea.setCaretPosition(textArea.getLineEndOffset(textArea.getLineCount()-1));This scrolls to the end of the JTextArea.
    Hope this helps,
    Kurt.

  • JTable: having first N columns not scroll with the rest of columns

    Hi All,
    I'm having trouble wording this properly (hence my inability to google for the solution)...
    What I am trying to do is:
    * Have a table with N number of columns (for example 100 columns).
    * The table is enclosed by scroll pane, so scrolling left and right will show different columns
    * I want first X number of columns (say 2 columns) to be always visible (i.e. they should not scroll with the rest of the columns)
    Is there a way to accomplish this with one JTable?
    Thanks and best regards,
    -Pavel

    I found the answer here:
    http://forum.java.sun.com/thread.jspa?threadID=665435&messageID=3951902
    Edited by: ptxyz on Jan 25, 2008 8:06 AM

  • With a high volume of tabs, scrolling to the end of the tab list often resets to the first tab

    Firefox 34.0.5
    When using a large number of tabs, around 300 inactive and 30 active tabs, when the currently selected tab is a tab on the far left side of the tab bar, attempting to scroll to the end (far right) side of the tab bar will often cause scrolling to freeze momentarily, and then reset to far left, to the currently selected tab, and continues scrolling from the beginning of the tab bar, making it unnecessarily difficult to scroll to the end of a long tabs bar.
    This occurs when scrolling up/down with the scroll-wheel on a mouse, when scrolling up/down/left/right on a touchpad, and when scrolling using the left and right scroll buttons in the tab bar.

    hello kirbysama, can you try to replicate this behaviour when you launch firefox in safe mode once? if not, maybe an addon is interfering here...
    [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]

  • ScrollPane can not scroll to the bottom

    Help wanted:
    I am using a scrollPane to display difference colored text which I used canvas to paint the text each time new text appended to it.
    The problem is the scrollbar can never scoll to the bottom of the ScrollPane's viewport even though I set the scroll position to the bottom of text height.
    I used:
    Adjustable v = scrollpane.getVAdjustable();
    System.out.println("get value:"+ v.getValue() );
    The value I got is not the value I set, If I set the scrollpostion y to 300, the value I get will be 285, always, 15 difference(the font I use is 11). the maximum and minimum are always same. So the vertical scrolbar is not scroll all the way to the bottom end, actully a little apart from the bottom end. so the last line of text is not showing.
    I tried everything, no use, I can not change ScrollPane....
    Any solutions here??? or anyone write their own ScrollPane, I 'd appreciated for anything....
    Thanks ahead!

    I have the same problem. I'm able to work around it if I select another message and then go back to the one that's not loading properly. So far, it always loads properly the second time. It's frustrating that I have to do that, but it works for me.

  • My touchpad will not scroll with the current version of foxfire.

    The screen in foxfire will not scroll with the sliding of my finger on right side of the touchpad on my lenovo thinkpad or the navigation button. It does work with all other programs including windows explorer and google chrome.

    OK, this is the original poster again. The trackpad scrolling problem has been sporadic. Now I have realized that I have this problem (in Firefox 7.0 and 7.01) WHEN THERE IS A PDF DOCUMENT OPEN IN ONE OF THE TABS. When there is a .pdf open, trackpad scrolling works fine in *that* tab but not in any of the other Firefox tabs that are open. When I close or move away from the .pdf file, then the scrolling function returns in the other tabs. Is there something about the Acrobat plug-in (ver. 9.4.5) that isn't working correctly in Firefox 7.x?

  • I got an iphone. when ive insert my sim card in it, it sat sim not valid. at the end its mentioned please contact apple support. can you help me

    i got an iphone. when ive insert my sim card in it, it sat sim not valid. at the end its mentioned please contact apple support. can you help me?

    Your phone is probably carrier locked and you are using a SIM form a different carrier. Are you?

  • Songs will not play to the end on only one of my computers

    Some of the songs in my library will not play to the end.  However, I have come to realize this is only happening on one of my computers.  The computer I sync with.  The same songs will play on my laptop and iPad.  ??? What gives?

    Just in case, check to see if "Crossfade songs" has been checked in your Playback preferences in iTunes. Here's a screenshot showing where to find it:
    If it is checked, try unchecking it and click OK.

  • Hi..can anyone help? Songs on my itunes are not playing to the end? They cut off part way through a song. Its not on all the songs but lots of them? thanks

    Hi..can anyone help? Songs on my itunes are not playing to the end? They cut off part way through a song. Its not on all the songs but lots of them? thanks

    A couple of months ago, I went to the Apple Store to try and sort this problem out. I was told that I was not playing my songs out of an actual music library. I created a library and loaded all of my songs, movies, etc. onto it. I had found that when I synced my songs from the new library onto my itouch, the songs no longer stopped in odd spots or bled into each other. To ensure that most of my songs had been fixed, I played the ones that were the most problematic. Fortunately, the songs play all the way through without any interruption. So far, I have not encountered the same problems that I had posted in my question. I apologize for not knowing the fellow's name who helped me with my iTouch at the Apple Store, but I would like to say how thankful and happy I am now that my iTouch no longer skips to the next song.
    I know that other people have had this same issue with their iPods. If you encounter your music not playing correctly, I would suggest that making a new library and  loading all of your music into the new one may help correct the problem. I hope that this helps.

  • Playhead will not stop at the end

    When I play my project in FCP the playhead will not stop at the end but will continue for a few seconds. So when I want to share my project I have to make a range so that I don't have a black clip at the end. There's no gap or what so ever on the timeline. How can I solve this? Thanks for your answers.

    Unfortunately, the problem is not solved. When I hit the end key the playhead goes to the end. Actually one frame further. Because when I go back one frame, I get the end clip symbol in the corner. But if I just play, the palyhead goes further for a 3 seconds. Then I get the clip symbol "negative edge" on the rightside. See also image. And there is nothing in the timeline.

  • Adobe captivate data not sending at the end of webinar. Is the adobe server still down?

    Adobe captivate data not sending at the end of webinar. Reads "unknown error." Is the adobe server still down? This has been ongoing all of july 2014.

    So the engineer came and, of course, everything was working ok. He did fit some kind of RF filter on my main socket, and 'changed the pair' on one of the outside cables. Since then, I've only had a noisy line once, and seem to have been connected for 3 days solid, which is a record!
    I've switched back to my BT Home hub 3, which guavas me more stats. The line has previously given me up to 6mb/s, now only getting 1.6.
    Do you think, now the line seems more stable, with the stats below I should be able to maintain a higher speed now?
    Thanks
    Line state: Connected
    Connection time: 3 days, 02:19:39
    Downstream: 1.601 Mbps
    Upstream: 444.9 Kbps
    ADSL Settings
    VPI/VCI: 0/38
    Type: PPPoA
    Modulation: G.992.3 Annex A
    Latency type: Interleaved
    Noise margin (Down/Up): 17.7 dB / 22.6 dB
    Line attenuation (Down/Up): 44.8 dB / 27.0 dB
    Output power (Down/Up): 18.6 dBm / 12.6 dBm
    FEC Events (Down/Up): 3144673 / 0
    CRC Events (Down/Up): 14434 / 38
    Loss of Framing (Local/Remote): 0 / 0
    Loss of Signal (Local/Remote): 0 / 0
    Loss of Power (Local/Remote): 0 / 0
    HEC Events (Down/Up): 111873 / 10
    Error Seconds (Local/Remote): 1011 / 4

  • Why the JScrollPane not scroll?

    I create a dialog,then I put a JScrollPane on the dialog,after this I put a JPanel on the JScrollPane,
    finally I put many checkbox on the JPanel.Due to having many checkboxes, I hope that JScrollPane can scroll,but it cannot scroll .how can I sove this problem?
    the following is my code:
    this.setSize(new Dimension(543, 523));
    this.getContentPane().setLayout(null);
    jButton3.setText("ok");
    jButton3.setBounds(new Rectangle(235, 455, 95, 30));
    jButton4.setText("cancel");
    jButton4.setBounds(new Rectangle(395, 455, 100, 30));
    // jScrollPane1.setBounds(new Rectangle(0, 20, 515, 1195));
    // jScrollPane1.setAutoscrolls(true);
    jPanel1.setBackground(Color.cyan);
    jPanel1.setLayout(null);
    jPanel1.setAutoscrolls(true);
    jPanel1.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    jCheckBox1.setText("attrib_manager");
    jCheckBox1.setBounds(new Rectangle(10, 10, 110, 25));
    ������������
    jCheckBox66.setBounds(new Rectangle(205, 1120, 97, 26));
    jCheckBox66.setEnabled(false);
    ������������
    jPanel1.add(jCheckBox66, null);
    jPanel1.add(jCheckBox1, null);
    JScrollPane jScrollPane1 = new JScrollPane(jPanel1);
    jScrollPane1.setBounds(new Rectangle(0, 20, 515, 425));
    jScrollPane1.setAutoscrolls(true);
    jScrollPane1.getViewport().add(jPanel1, null);
    this.getContentPane().add(jScrollPane1, null);
    this.getContentPane().add(jButton4, null);
    this.getContentPane().add(jButton3, null);

    You have to set size of your panel.
    override method getPrefferedSize() of panel. This methd should return correct size of content.
    best regadrs
    Stas

  • Force to scroll to the ende of a IFrame

    Hello experts,
    could anyone please explain me if it is possible to enable a button after scrolling a IFrame until the end of the page?
    PsychoCode:
    Something like this:
    --> If IframeScrollToEnd then enable Button.
    Many thanks
    Marco

    in planning board
    go to the menu path
    Edit ->Show/hide -> Show milestone
    Hide whatever you do not want

  • How do you scroll to the end of the address line (url)?

    This has been a frustration for me because there are times I need to erase part of the end, or add to the end.  If I have to erase, I don't want to start in the middle and let it scroll to me as I delete because most of the time, I'm deleting parts that I want to keep.  And I need to be able to add to the end, for example, when I'm searching for the date a web article was written.
    This may have a simple answer because I've searched for this for awhile and I can't find anyone who has this problem. So, I may be a dummy but I really need to know how to do this.  Thanks for your help.

    Snickersnake wrote:
    I don't want to start in the middle and let it scroll to me
    I know of no other way to do it. I tap and hold down until the magnifying glass pops up and then move the magnifying glass all the way to the right to get to the end of the address. I have never found another way to do it.
    This may have a simple answer because I've searched for this for awhile and I can't find anyone who has this problem. So, I may be a dummy but I really need to know how to do this. 
    I wish there was another answer. I guess we must both be dummies because I can't figure another way to do it either in Safari.
    Actually, my solution is to not use Safari. I don't like it and I never did. It is faster than any other iOS browser that I have tried, and I have tried about 8 of them. I keep 6 of them on my iPad and I use iCab Mobile 99.9% of the time. I only use Safari when and if I have to - like when you click on a link in an email and Safari launches as the default browser. Safari pales in comparison when comparing features with other browsers....but I digress.

  • Forms application not opening for the end user.

    I have an Oracle Form that works fine when I copy the url into the browser and user the login credentials of the schema owner. But when I use the credentials of the end user, it does not open the form. I receive no error messages.
    To troubleshoot, I opened the form in Forms Builder, log in as the end user and Compile, but I get no error messages.
    I also took a call to a server-side procedure that is in the Form, and ran it in SQL Developer, once again while logged in as the end user, and it ran successfully.
    I’m not sure what could be wrong. Any suggestions on how to debug this?

    To troubleshoot, I opened the form in Forms Builder, log in as the end user and Compile, but I get no error messages.What happens if you run the form from forms-builder with that credentials.

Maybe you are looking for