Pagination and style in JavaFX TableView

Hello geeks, I think most of you have already knew that JavaFX 2.2 contains the “Pagination” which is really awesome although it is not pretty hard to make our own. Lets first look over how the Pagination actually looks like.



Normal Pagination

Ok now that was just the normal Pagination you can modify and change as per your need . You can just style it using some CSS codes.


2. CODE  (How to make Pagination)

As Pagination is inherited from Control class; we can easily place this control at any container like Group,Pane etc.


3.STYLE (Make it different)

Although the default style of this control is actually good but the default is not suitable when it comes for the vendor specific design and for different purposes. Lets looks at some CSS styling which I have done differently.


Diamond Style Pagination

Diamond Style Pagination

EFFECT: Drop Shadow


Circle Numbering Pagination

Circle Style Pagination|

EFFECT: Drop Shadow

Grid Style Pagination

Grid Style Pagination

Effects: Drop Shadow

After working with some styling and Pagination I have made this pagination to work in TableView as well which was really amazing. The below is the screenshot of that demo application.

TableView and Pagination JavaFX

Source Code: Pagination Demo Source Code

This much for today Have a great day coding 🙂

17 thoughts on “Pagination and style in JavaFX TableView”

  1. Pingback: Java desktop links of the week, March 11 | Jonathan Giles

  2. Nice examples. Circle Numbering & Grid Style pagination with drop shadows really looks cool. Please keep up the good work.

    In my case I require label instead of showing number of pages as 1/4 in your example with a label showing Page 1 of 4. Is it possible? How to achieve that?

    Thanks & Regards,
    Hiren Desai

  3. Hi! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest authoring a blog article or
    vice-versa? My website discusses a lot of the same topics as yours and I believe we could greatly benefit from each
    other. If you might be interested feel free to send me an e-mail.
    I look forward to hearing from you! Terrific blog by
    the way!

  4. Thanks for some other wonderful post. Where else may anybody
    get that type of info in such a perfect method of writing?
    I have a presentation next week, and I am at the search for such information.

  5. Hi there,
    I’m here to actually talk about a problem that has been asked almost everywhere but not a once discussed or even code shown !!
    Even at Oracle site, all they do are nothing but mere static codes
    The problem in iteself is, i have a tableview which is filled from a database !!
    When i click on a row in the tableview, i want to get the first colomn’s value of the selected row !!
    In java, when yu include the rs2xml.jar library, yu have a method that is getValueAt(row,coloumn) but as far as i have searched, i didn’t get to find a way to do this !!
    I really need help for this, it concerns my final year’s project !!

  6. Hey nice work :).

    But is there a work around to get table sorting done even with pagination?
    Because i can click the headers and they will sort the given page not the whole list.

  7. @Chris,
    For making the sorting done you need to make your own way. Because javafx only provides the sorting of table with in the content of tableview.
    How to make this happen:
    1. Take the table header control Node from CSS selector via Node class
    2. Then use click event listener to that node
    3. apply your logic and then sort the whole pagination 🙂


  8. Oh my goodness! Awesome article dude! Thank you so much,
    However I am going through difficulties with your RSS. I don’t understand the reason why I can’t
    subscribe to it. Is there anybody getting the same RSS problems?
    Anyone that knows the answer will you kindly respond?

  9. thanks for answer.another question.
    I need change special row for example :rows with values of negative.
    this is need to implement with code of javafx and not css.can you guide me?

  10. How can i change message in the table when table is empty?
    When table is empty pagination in below of table is a lot buttons!! how can i remove that?

  11. Hi ..i saw most of the sample code gave only fixed size of no.of rows per page , but my requirement is need to choose different no of rows per page by clicking
    hyperlink for pagination, and this pagination needs to work by both filtered items and table items ..

  12. Pingback: Java desktop links of the week, March 11 – Jonathan Giles

Leave a Reply