This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
i have a registration page.
now i want to generate a dynamic report of student.
how can i do that??
what i m thinking is:
just fetching the values from the database, and displaying them in textfield or labels, and add the logo, and then print that.
is that only i can do??
or any other thing??
and if this only then how will i print them??
You can also think of using a reporting engine like JasperReports. It comes with a report designer named iReport. You can design the report and use it by passing POJOs - Jasper provides easy integration with Swing via JPanel and then you should be able to print that JPanel or JDialog on which the report is displayed.
SCJP 1.4, OCMJEA/SCEA 5.0.
Joined: Aug 20, 2011
if i go with 1st one, i mean without using jasper report..
can you tell me how can i do that?
i mean my page(hardcopy) is (which has header and footer) fixed.
i need to print the report in between header an footer..
how do i do that??
You have to use the Printing API. You can check out the tutorial here.
Swing components have printing support. If it is just a JPanel, I think it would be easier. You have to place the components (say labels) using layouts or 'paint' directly using Graphics object. You have to implement the Printable interface which has a method to return the number of pages left. However, if you need a header/footer + variable information in the middle (that spawns pages), it will be slightly harder.
You can refer these JavaRanch posts (comes up straight in a Google search):