Inserting Page Numbers
Hi everyone,
I have a jtextpane with some text which spans to about 10 pages and what i want to able to insert page numbers into the center bottom of the page. I am using the DefaultStyledDocument class as the default document type for my jtextpane.
I hope someone can explain to me or show me some codings that can help me to insert the page numbers into the jtextpane
Thank You
Yours Sincerely
Richard West
freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10
You don't want the page numbers inserted into the text editor.
What will happen if you add or remove text? The numbers will now no longer be properly positioned, instead showing in the middle of the pages.
Instead you'd better customise your printing routine (I guess you want to print things?) to insert page numbers every X lines and a pagebreak directly after that.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
hi everyone,
Yes you are right but how will you go about doing this
Richard West
freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10
Hi everyone,
I managed to do it thanks to you pointing me to the right direction
jwenting
Any way here is what i added in
g.drawString(("Page " + (pageIndex + 1)), 225, 645);
Thank You
Richard West
freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10