• Post Reply Bookmark Topic Watch Topic
  • New Topic

headerFormat font size problem

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm using jTable's print method:
public boolean print(JTable.PrintMode printMode,
MessageFormat headerFormat,
MessageFormat footerFormat)
throws PrinterException

docs advertise for problems:
The Printable constrains what it draws to the printable area of each page that it prints. Under certain circumstances, it may find it impossible to fit all of a page's content into that area. In these cases the output may be clipped, but the implementation makes an effort to do something reasonable. Here are a few situations where this is known to occur, and how they may be handled by this particular implementation:

In any mode, when the header or footer text is too wide to fit completely in the printable area -- print as much of the text as possible starting from the beginning, as determined by the table's ComponentOrientation.

i wonder how i can control header font size

TiA
 
Sven Farrenkopf
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Though this thread is pretty old, I guess I post some solutions:

The first possible solution I found here, though I haven't tested it:

http://forums.sun.com/thread.jspa?threadID=5306808&tstart=93

Second possible solution:

1) Take the code of TablePrintable and copy it in your own class "MyTablePrintable".
2) Modify the constructor where needed. headerFont and footerFont can be set here! (Why did they make this private?)
3) When creating the JTable, overwrite "getPrintable" so it returns an instance of MyTablePrintable. (Of course you can also do this by creating your own subclass)

Sven
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!