Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

change TITLE dimension in Printable?  RSS feed

 
Greenhorn
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
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!