Switched to using a Pageable in hopes that this would cause Java to allow
the user to print only particular pages, but it doesn't seem to make use of the pageable information to do that. Alas. git-svn-id: https://samskivert.googlecode.com/svn/trunk@264 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: VizController.java,v 1.1 2001/08/14 00:45:56 mdb Exp $
|
||||
// $Id: VizController.java,v 1.2 2001/08/14 00:58:15 mdb Exp $
|
||||
|
||||
package com.samskivert.viztool;
|
||||
|
||||
@@ -60,9 +60,26 @@ public class VizController extends Controller
|
||||
return true;
|
||||
|
||||
} else if (cmd.equals(PRINT)) {
|
||||
// tell the job to print our visualizer with the format we set
|
||||
// up earlier
|
||||
_job.setPrintable(_vpanel.getVisualizer(), _format);
|
||||
// create a pageable to be used by our print job that does the
|
||||
// right thing
|
||||
Pageable pable = new Pageable()
|
||||
{
|
||||
public int getNumberOfPages ()
|
||||
{
|
||||
return _vpanel.getVisualizer().getPageCount();
|
||||
}
|
||||
|
||||
public PageFormat getPageFormat (int pageIndex)
|
||||
{
|
||||
return _format;
|
||||
}
|
||||
|
||||
public Printable getPrintable (int pageIndex)
|
||||
{
|
||||
return _vpanel.getVisualizer();
|
||||
}
|
||||
};
|
||||
_job.setPageable(pable);
|
||||
|
||||
// pop up a dialog to control printing
|
||||
if (_job.printDialog()) {
|
||||
|
||||
Reference in New Issue
Block a user