Results 1 to 7 of 7
  1. #1
    pink123 is offline Member
    Join Date
    Feb 2011
    Posts
    84
    Rep Power
    0

    Default jtable showing limited rows

    Hi,

    I have jtable which shows only a limited rows(353) when data is large.
    I checked database is returning 899 rows but my jtable only shows 353 rows .
    Does jtable has a size limitation or is there any property for jtable which sets the maximum number of rows?

    Please help.

    Thanks

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    See How to Use Tables (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
    In particular, the section regarding writing a TableModel (and the getRowCount() method of TableModel (Java Platform SE 6))

  3. #3
    pink123 is offline Member
    Join Date
    Feb 2011
    Posts
    84
    Rep Power
    0

    Default

    Thanks for your reply.
    I did system.out.println(table.getRowCount) .It is showing the row count as 899 same as that returned from the database but it displays only 353.
    My jtable is within a jscrollpane.I have checked the properties such as verticalscrollbar is set as AS_Needed but I am not able to scroll after 353 row.
    Please help.

    Thanks,
    Manshu

  4. #4
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default

    Why are you still asking questions without posting a SSCCE. The problem is with your code, not JTable.

    Create a simple program that loops 1,000 times and add rows of data to the TableModel and then add the table model to the JTable. Prove that it works, then determine what is different from your working code and your real program.

    There is no way we can guess your mistake.

  5. #5
    pink123 is offline Member
    Join Date
    Feb 2011
    Posts
    84
    Rep Power
    0

    Default

    Thanks for your reply.
    I tried with a for loop .All rows areshown fine but when it comes to displaying ,its showing only 353 rows.I think it is because of JscrollPane size or some property.
    I have tried changing the size but it doesnt help.

    Thanks,

  6. #6
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    To reiterate camickr's advice...post an SSCCE. We're left guessing otherwise.

  7. #7
    pink123 is offline Member
    Join Date
    Feb 2011
    Posts
    84
    Rep Power
    0

    Default

    Its fixed now.The problem is not in the tablemodel but with the preffered size for the table. Refer
    JScrollPane (Java 2 Platform SE v1.4.2)

    If the table preffered size is small it would not be accomodated in the scrollpanes view.

    Thanks,

Similar Threads

  1. Jtable rows
    By riddhishah28 in forum AWT / Swing
    Replies: 3
    Last Post: 02-18-2011, 06:24 AM
  2. How to Add,Remove Rows in JTable
    By Dinesh_rockz in forum AWT / Swing
    Replies: 2
    Last Post: 02-03-2011, 05:30 AM
  3. Remove Jtable rows
    By anilkumar_vist in forum Advanced Java
    Replies: 2
    Last Post: 09-17-2010, 08:03 AM
  4. Listening rows in JTable ??
    By Stephen Douglas in forum New To Java
    Replies: 2
    Last Post: 04-10-2010, 04:45 PM
  5. display rows in jtable
    By osval in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 08:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •