本文整理汇总了Java中javax.print.attribute.standard.PrintQuality.NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Java PrintQuality.NORMAL属性的具体用法?Java PrintQuality.NORMAL怎么用?Java PrintQuality.NORMAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.print.attribute.standard.PrintQuality
的用法示例。
在下文中一共展示了PrintQuality.NORMAL属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showPrintSetupDialog
/**
* Show a print setup dialog, to alter the ViewerModel's PageFormat
*
* @see ViewModel
*/
public void showPrintSetupDialog() {
PrintHelper printHelper = viewModel.getPrintHelper();
// create a new print helper for this document instance
if (printHelper == null) {
MediaSizeName mediaSizeName = loadDefaultPrinterProperties();
// create the new print help
printHelper = new PrintHelper(documentViewController.getViewContainer(),
getPageTree(), documentViewController.getRotation(), mediaSizeName,
PrintQuality.NORMAL);
}
// reuse previous print attributes if they exist.
else {
printHelper = new PrintHelper(documentViewController.getViewContainer(),
getPageTree(), documentViewController.getRotation(),
printHelper.getDocAttributeSet(),
printHelper.getPrintRequestAttributeSet());
}
viewModel.setPrintHelper(printHelper);
viewModel.getPrintHelper().showPrintSetupDialog();
// save new printer attributes to properties
savePrinterProperties(printHelper);
}
示例2: setQualityAttrib
private void setQualityAttrib(Attribute attr) {
if (attr == PrintQuality.HIGH) {
mAttQuality = -4; // DMRES_HIGH
} else if (attr == PrintQuality.NORMAL) {
mAttQuality = -3; // DMRES_MEDIUM
} else {
mAttQuality = -2; // DMRES_LOW
}
}
示例3: getPrintQuality
public PrintQuality getPrintQuality() {
switch (getDmPrintQuality(structPtr)) {
case DMRES_HIGH:
return PrintQuality.HIGH;
case DMRES_DRAFT:
return PrintQuality.DRAFT;
default:
return PrintQuality.NORMAL;
}
}
示例4: selectQualityButton
private void selectQualityButton(PrintQuality par) {
if (par == null) {
par = PrintQuality.NORMAL;
}
if (par.equals(PrintQuality.DRAFT)) {
draftBtn.setSelected(true);
} else if (par.equals(PrintQuality.HIGH)) {
highBtn.setSelected(true);
} else {
normalBtn.setSelected(true);
}
}
示例5: getSelectedQuality
private PrintQuality getSelectedQuality() {
if (normalBtn.isSelected()) {
return PrintQuality.NORMAL;
} else if (draftBtn.isSelected()) {
return PrintQuality.DRAFT;
} else if (highBtn.isSelected()) {
return PrintQuality.HIGH;
} else {
return null;
}
}
示例6: setNativeAttributes
private final void setNativeAttributes(int flags, int fields, int values) {
if (attributes == null) {
return;
}
if ((flags & PD_PRINTTOFILE) != 0) {
Destination destPrn = (Destination)attributes.get(
Destination.class);
if (destPrn == null) {
try {
attributes.add(new Destination(
new File("./out.prn").toURI()));
} catch (SecurityException se) {
try {
attributes.add(new Destination(
new URI("file:out.prn")));
} catch (URISyntaxException e) {
}
}
}
} else {
attributes.remove(Destination.class);
}
if ((flags & PD_COLLATE) != 0) {
setCollateAttrib(SheetCollate.COLLATED, attributes);
} else {
setCollateAttrib(SheetCollate.UNCOLLATED, attributes);
}
if ((flags & PD_PAGENUMS) != 0) {
attributes.add(SunPageSelection.RANGE);
} else if ((flags & PD_SELECTION) != 0) {
attributes.add(SunPageSelection.SELECTION);
} else {
attributes.add(SunPageSelection.ALL);
}
if ((fields & DM_ORIENTATION) != 0) {
if ((values & SET_ORIENTATION) != 0) {
setOrientAttrib(OrientationRequested.LANDSCAPE, attributes);
} else {
setOrientAttrib(OrientationRequested.PORTRAIT, attributes);
}
}
if ((fields & DM_COLOR) != 0) {
if ((values & SET_COLOR) != 0) {
setColorAttrib(Chromaticity.COLOR, attributes);
} else {
setColorAttrib(Chromaticity.MONOCHROME, attributes);
}
}
if ((fields & DM_PRINTQUALITY) != 0) {
PrintQuality quality;
if ((values & SET_RES_LOW) != 0) {
quality = PrintQuality.DRAFT;
} else if ((fields & SET_RES_HIGH) != 0) {
quality = PrintQuality.HIGH;
} else {
quality = PrintQuality.NORMAL;
}
setQualityAttrib(quality, attributes);
}
if ((fields & DM_DUPLEX) != 0) {
Sides sides;
if ((values & SET_DUP_VERTICAL) != 0) {
sides = Sides.TWO_SIDED_LONG_EDGE;
} else if ((values & SET_DUP_HORIZONTAL) != 0) {
sides = Sides.TWO_SIDED_SHORT_EDGE;
} else {
sides = Sides.ONE_SIDED;
}
setSidesAttrib(sides, attributes);
}
}
示例7: setNativeAttributes
private void setNativeAttributes(int flags, int fields, int values) {
if (attributes == null) {
return;
}
if ((flags & PD_PRINTTOFILE) != 0) {
Destination destPrn = (Destination)attributes.get(
Destination.class);
if (destPrn == null) {
try {
attributes.add(new Destination(
new File("./out.prn").toURI()));
} catch (SecurityException se) {
try {
attributes.add(new Destination(
new URI("file:out.prn")));
} catch (URISyntaxException e) {
}
}
}
} else {
attributes.remove(Destination.class);
}
if ((flags & PD_COLLATE) != 0) {
setCollateAttrib(SheetCollate.COLLATED, attributes);
} else {
setCollateAttrib(SheetCollate.UNCOLLATED, attributes);
}
if ((flags & PD_NOSELECTION) != PD_NOSELECTION) {
if ((flags & PD_PAGENUMS) != 0) {
attributes.add(SunPageSelection.RANGE);
} else if ((flags & PD_SELECTION) != 0) {
attributes.add(SunPageSelection.SELECTION);
} else {
attributes.add(SunPageSelection.ALL);
}
}
if ((fields & DM_ORIENTATION) != 0) {
if ((values & SET_ORIENTATION) != 0) {
setOrientAttrib(OrientationRequested.LANDSCAPE, attributes);
} else {
setOrientAttrib(OrientationRequested.PORTRAIT, attributes);
}
}
if ((fields & DM_COLOR) != 0) {
if ((values & SET_COLOR) != 0) {
setColorAttrib(Chromaticity.COLOR, attributes);
} else {
setColorAttrib(Chromaticity.MONOCHROME, attributes);
}
}
if ((fields & DM_PRINTQUALITY) != 0) {
PrintQuality quality;
if ((values & SET_RES_LOW) != 0) {
quality = PrintQuality.DRAFT;
} else if ((fields & SET_RES_HIGH) != 0) {
quality = PrintQuality.HIGH;
} else {
quality = PrintQuality.NORMAL;
}
setQualityAttrib(quality, attributes);
}
if ((fields & DM_DUPLEX) != 0) {
Sides sides;
if ((values & SET_DUP_VERTICAL) != 0) {
sides = Sides.TWO_SIDED_LONG_EDGE;
} else if ((values & SET_DUP_HORIZONTAL) != 0) {
sides = Sides.TWO_SIDED_SHORT_EDGE;
} else {
sides = Sides.ONE_SIDED;
}
setSidesAttrib(sides, attributes);
}
}
示例8: setNativeAttributes
private void setNativeAttributes(int flags, int fields, int values) {
if (attributes == null) {
return;
}
if ((flags & PD_PRINTTOFILE) != 0) {
Destination destPrn = (Destination)attributes.get(
Destination.class);
if (destPrn == null) {
try {
attributes.add(new Destination(
new File("./out.prn").toURI()));
} catch (SecurityException se) {
try {
attributes.add(new Destination(
new URI("file:out.prn")));
} catch (URISyntaxException e) {
}
}
}
} else {
attributes.remove(Destination.class);
}
if ((flags & PD_COLLATE) != 0) {
setCollateAttrib(SheetCollate.COLLATED, attributes);
} else {
setCollateAttrib(SheetCollate.UNCOLLATED, attributes);
}
if ((flags & PD_PAGENUMS) != 0) {
attributes.add(SunPageSelection.RANGE);
} else if ((flags & PD_SELECTION) != 0) {
attributes.add(SunPageSelection.SELECTION);
} else {
attributes.add(SunPageSelection.ALL);
}
if ((fields & DM_ORIENTATION) != 0) {
if ((values & SET_ORIENTATION) != 0) {
setOrientAttrib(OrientationRequested.LANDSCAPE, attributes);
} else {
setOrientAttrib(OrientationRequested.PORTRAIT, attributes);
}
}
if ((fields & DM_COLOR) != 0) {
if ((values & SET_COLOR) != 0) {
setColorAttrib(Chromaticity.COLOR, attributes);
} else {
setColorAttrib(Chromaticity.MONOCHROME, attributes);
}
}
if ((fields & DM_PRINTQUALITY) != 0) {
PrintQuality quality;
if ((values & SET_RES_LOW) != 0) {
quality = PrintQuality.DRAFT;
} else if ((fields & SET_RES_HIGH) != 0) {
quality = PrintQuality.HIGH;
} else {
quality = PrintQuality.NORMAL;
}
setQualityAttrib(quality, attributes);
}
if ((fields & DM_DUPLEX) != 0) {
Sides sides;
if ((values & SET_DUP_VERTICAL) != 0) {
sides = Sides.TWO_SIDED_LONG_EDGE;
} else if ((values & SET_DUP_HORIZONTAL) != 0) {
sides = Sides.TWO_SIDED_SHORT_EDGE;
} else {
sides = Sides.ONE_SIDED;
}
setSidesAttrib(sides, attributes);
}
}
示例9: getSupportedAttributeValues
public Object getSupportedAttributeValues(
final Class<? extends Attribute> category,
final DocFlavor flavor, final AttributeSet attributes) {
checkArgs(category, flavor);
try {
if (OrientationRequested.class.equals(category)) {
return WinPrinterFactory
.getSupportedOrientations(getPrinterHandle());
} else if (Media.class.equals(category)
|| MediaSizeName.class.equals(category)) {
return WinPrinterFactory
.getSupportedMediaSizeNames(getPrinterHandle());
} else if (MediaSize.class.equals(category)) {
return WinPrinterFactory
.getSupportedMediaSizes(getPrinterHandle());
} else if (CopiesSupported.class.equals(category)) {
final int max = WinPrinterFactory
.getMaxNumberOfCopies(getPrinterHandle());
return max > 1 ? new CopiesSupported(1, max)
: new CopiesSupported(1);
} else if (PrintQuality.class.equals(category)) {
return new PrintQuality[] { PrintQuality.HIGH,
PrintQuality.NORMAL, PrintQuality.DRAFT };
} else if (Sides.class.equals(category)) {
return WinPrinterFactory.isDuplexSupported(getPrinterHandle())
? new Sides[] { Sides.ONE_SIDED,
Sides.TWO_SIDED_SHORT_EDGE,
Sides.TWO_SIDED_LONG_EDGE }
: new Sides[] { Sides.ONE_SIDED };
} else if (SheetCollate.class.equals(category)) {
return WinPrinterFactory.isDuplexSupported(getPrinterHandle())
? new SheetCollate[] { SheetCollate.COLLATED,
SheetCollate.UNCOLLATED }
: new SheetCollate[] { SheetCollate.UNCOLLATED };
} else if (Chromaticity.class.equals(category)) {
return WinPrinterFactory
.isColorPrintingSupported(getPrinterHandle())
? new Chromaticity[] { Chromaticity.MONOCHROME,
Chromaticity.COLOR }
: new Chromaticity[] { Chromaticity.MONOCHROME };
} else if (PrinterResolution.class.equals(category)) {
return WinPrinterFactory
.getSupportedPrinterResolutions(getPrinterHandle());
} else if (PrintQuality.class.equals(category)) {
return new PrintQuality[] { PrintQuality.HIGH,
PrintQuality.NORMAL, PrintQuality.DRAFT };
}
} catch (final PrintException ex) {
throw new RuntimeException(ex);
}
return null;
}
示例10: initialisePrinting
/**
* If the <code>withDialog</code> parameter is true, show a print dialog,
* defaulted to print all pages. If the click Ok, then print the page range
* they have specified, else if they clicked Cancel, then abort the printing
* <p/>
* If the <code>withDialog</code> parameter is false, then print all pages of
* the PDF Document without showing and print dialogs
*
* @param withDialog If should show a print dialog before starting to print
*/
private void initialisePrinting(final boolean withDialog) {
boolean canPrint = havePermissionToPrint();
if (!canPrint) {
reenablePrintUI();
return;
}
// create a new print helper, one-to-one with document, make sure that
// previous printer properties are preserved. default values listed
// below are for NA_letter in millimeters.
PrintHelper printHelper = viewModel.getPrintHelper();
if (printHelper == null) {
MediaSizeName mediaSizeName = loadDefaultPrinterProperties();
// create the new print help
printHelper = new PrintHelper(documentViewController.getViewContainer(),
getPageTree(), documentViewController.getRotation(),
mediaSizeName, PrintQuality.NORMAL);
} else {
printHelper = new PrintHelper(documentViewController.getViewContainer(),
getPageTree(), documentViewController.getRotation(),
printHelper.getDocAttributeSet(),
printHelper.getPrintRequestAttributeSet());
}
viewModel.setPrintHelper(printHelper);
// set the printer to show a print dialog
canPrint = printHelper.setupPrintService(
0,
document.getNumberOfPages() - 1,
viewModel.getPrintCopies(), // default number of copies.
viewModel.isShrinkToPrintableArea(), // shrink to printable area
withDialog // show print dialogl
);
// save new printer attributes to properties
savePrinterProperties(printHelper);
// if user cancelled the print job from the dialog, don't start printing
// in the background.
if (!canPrint) {
reenablePrintUI();
return;
}
startBackgroundPrinting(printHelper);
}
示例11: setPrintDefaultMediaSizeName
/**
* Sets the default MediaSizeName and creates an new instance of the
* the PrintHelp with the new media size. The media size is also
* persisted to the PropertiesManager.
* <p/>
* <b/>Note:</b> this method should only be called after a valid file or
* file stream has been loaded by the controller otherwise a null pointer
* will result.
*
* @param mediaSize MediaSizeName constant of paper size to print to.
*/
public void setPrintDefaultMediaSizeName(MediaSizeName mediaSize) {
PrintHelper printHelper = new PrintHelper(
documentViewController.getViewContainer(), getPageTree(),
documentViewController.getRotation(),
mediaSize,
PrintQuality.NORMAL);
viewModel.setPrintHelper(printHelper);
// save new printer attributes to properties
savePrinterProperties(printHelper);
}