java orientation_Java PageFormat.getOrientation方法代码示例

import java.awt.print.PageFormat; //导入方法依赖的package包/类

private void setSize() {

int pageCount = printable.getPageCount();

rowCount = (pageCount - 1) / columnCount + 1;

pageWidth = 0;

pageHeight = 0;

pages = new Page[pageCount];

PageFormat pageFormat = printable.getPageFormat();

for (int i = 0; i < pageCount; i++) {

pageFormat = printable.getPageFormat(pageFormat, i);

double w = pageFormat.getWidth() + 1;

double h = pageFormat.getHeight() + 1;

double iW = pageFormat.getImageableWidth();

double iH = pageFormat.getImageableHeight();

double x = pageFormat.getImageableX();

double y = pageFormat.getImageableY();

reverce = (pageFormat.getOrientation() == PageFormat.REVERSE_LANDSCAPE);

/*

* if (pageFormat.getOrientation() == PageFormat.LANDSCAPE) { double

* t;

*

* t = w; w = h; h = t;

*

* t = iW; iW = iH; iH = t;

*

* t = x; x = y; y = t; }

*/

Page page = new Page(w, h, x, y, iW, iH);

if (pageWidth < w)

pageWidth = w;

if (pageHeight < h)

pageHeight = h;

pages[i] = page;

}

width = (columnCount - 1) * (pageWidth + W_SPACE / zoom) + pageWidth;

height = rowCount * (pageHeight + W_SPACE / zoom);

Dimension size = new Dimension((int) (width * getZoom()),

(int) (height * getZoom()));

this.setSize(size);

this.setPreferredSize(size);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值