as we know Java does not provide any classes to preview JComponent before sending it to printer. So, I want to build my own class/classes to make a preview JFrame for this purpose. Just like a "Print Preview" frame e.g. in Word, Excel, etc.

Could you please advise me what steps I need to take in order to:

  • pass a JTable in Graphics2D object in order to print it on screen
  • create a Pageable object from the JTable as to getNumOfPages of the JTable
  • how to use Book and what steps to take as to split the JTable in multiple pages inside Book
  • how to go through preview pages when pressing "nextPage" and "previousPage" JButtons
  • how to zoom in and a zoom out the preview of the current page
    (using getScaledInstance from BufferedImage is not what I want, since it does not produce nice results even in BufferedImage.SCALE_SMOOTH mode and it is very slow)

Are my thoughts correct ?

Any advice would be highly appreciated.