• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

change TITLE dimension in Printable?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
job.setPrintable(printable);

// 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)
job.print(attr);
}
}
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic