• Post Reply Bookmark Topic Watch Topic
  • New Topic

change TITLE dimension in Printable?  RSS feed

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI, I use this method to print my JTable with header (Title) and footer (page number):

public static void PrintTable(JTable mytable, String titletable) {

try {
// fetch the printable
Printable printable = mytable.getPrintable(JTable.PrintMode.FIT_WIDTH,
new MessageFormat(titletable),
new MessageFormat("Page - {0}"));

// fetch a PrinterJob
PrinterJob job = PrinterJob.getPrinterJob();

// set the Printable on the PrinterJob

// create an attribute set to store attributes from the print dialog
PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();

// display a print dialog and record whether or not the user cancels it
boolean printAccepted = job.printDialog(attr);

// if the user didn't cancel the dialog
if (printAccepted) {
// do the printing (may need to handle PrinterException)
catch(Exception gh){

finally {
// restore the original table state here (for example, restore selection)


it's all ok ... I want change the font size to the TITLE (HEADER) because now print a title with big font size.

Is it possible to do it?

thanks a lot
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!