Hi, I have a JDialog.In that dialog i have a JPanel in whcih I have added a JLabel and a JTable(JTable is being added to the scroll pane and in turn scroll pane is added to panel) Now I have a button called print in the action event of which I am printing the JPanel(Containg the label and sroll pane wih JTable). The printing is working fine.But the problem is that when the rows of JTable is more than sp that to see the all rows of JTable user has to scroll the scroll bar and see the rows.In that case when i say print,only those rows of the table is pritned that is visble.The rest rows that is not visible to user(I mean for which user scrolls the scroll bar)is not printed.Can any one help me out how to print the all rows of JTable. Morever can I restrict user to print only in LANDSCAPE.
posted 13 years ago
Shure, if you print the content of your JPanel, then only the visible part is printed. If you want to print the whole JTable, you need to print only the JTable. The problem is, if you do it in that way, only one page is printed out and if your table is larger, then not all of the rows will be visible on your paper. So you have to calculate, how many sheets of paper you will need for a complete printout and you have to print every printable rectangle. But as far as I know, there are already some classes available, which are doing that. Here is one example: JTable Printing