本文整理汇总了Java中sun.print.SunPageSelection类的典型用法代码示例。如果您正苦于以下问题:Java SunPageSelection类的具体用法?Java SunPageSelection怎么用?Java SunPageSelection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SunPageSelection类属于sun.print包,在下文中一共展示了SunPageSelection类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import sun.print.SunPageSelection; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
SunPageSelection select = SunPageSelection.ALL;
setupRangeWidgets();
if (source == rbAll) {
asCurrent.add(prAll);
} else if (source == rbSelect) {
select = SunPageSelection.SELECTION;
} else if (source == rbPages ||
source == tfRangeFrom ||
source == tfRangeTo) {
updateRangeAttribute();
select = SunPageSelection.RANGE;
}
if (isAWT) {
asCurrent.add(select);
}
}
示例2: getSelectAttrib
import sun.print.SunPageSelection; //导入依赖的package包/类
protected final int getSelectAttrib() {
if (attributes != null) {
SunPageSelection pages =
(SunPageSelection)attributes.get(SunPageSelection.class);
if (pages == SunPageSelection.RANGE) {
return PD_PAGENUMS;
} else if (pages == SunPageSelection.SELECTION) {
return PD_SELECTION;
} else if (pages == SunPageSelection.ALL) {
return PD_ALLPAGES;
}
}
return PD_NOSELECTION;
}
示例3: setValues
import sun.print.SunPageSelection; //导入依赖的package包/类
final public void setValues() {
this.bolGprintRangeSupported = this.objGprintJDialog.getPrintService().isAttributeCategorySupported(PageRanges.class);
SunPageSelection objLsunPageSelection = SunPageSelection.ALL;
int intLmin = 1;
int intLmax = 1;
final PageRanges objLpageRanges = (PageRanges) this.objGprintJDialog.getAttributes().get(PageRanges.class);
if (objLpageRanges != null) {
if (!objLpageRanges.equals(this.objGallPageRanges)) {
objLsunPageSelection = SunPageSelection.RANGE;
final int[][] intLmemberAA = objLpageRanges.getMembers();
if (intLmemberAA.length > 0 && intLmemberAA[0].length > 1) {
intLmin = intLmemberAA[0][0];
intLmax = intLmemberAA[0][1];
}
}
}
if (objLsunPageSelection == SunPageSelection.ALL) {
this.objGallJRadioButton.setSelected(true);
} else if (objLsunPageSelection == SunPageSelection.SELECTION) {
// Comment this for now - objGselectJRadioButton is not initialized
// because Selection button is not added.
// See PrintRangeSubJPanel above.
// objGselectJRadioButton.setSelected(true);
} else { // RANGE
this.objGpagesJRadioButton.setSelected(true);
}
this.objGrangeFromJFormattedTextField.setValue(new Integer(intLmin));
this.objGrangeToJFormattedTextField.setValue(new Integer(intLmax));
this.objGallJRadioButton.setEnabled(this.bolGprintRangeSupported);
this.objGpagesJRadioButton.setEnabled(this.bolGprintRangeSupported);
this.setupRangeWidgets();
}
示例4: initPrintDialog
import sun.print.SunPageSelection; //导入依赖的package包/类
/**
* Initialize print dialog.
*/
void initPrintDialog(int x, int y,
PrintService[] services,
int defaultServiceIndex,
DocFlavor flavor,
PrintRequestAttributeSet attributes)
{
this.services = services;
this.defaultServiceIndex = defaultServiceIndex;
this.asOriginal = attributes;
this.asCurrent = new HashPrintRequestAttributeSet(attributes);
this.psCurrent = services[defaultServiceIndex];
this.docFlavor = flavor;
SunPageSelection pages =
(SunPageSelection)attributes.get(SunPageSelection.class);
if (pages != null) {
isAWT = true;
}
if (attributes.get(DialogOnTop.class) != null) {
setAlwaysOnTop(true);
}
Container c = getContentPane();
c.setLayout(new BorderLayout());
tpTabs = new JTabbedPane();
tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5));
String gkey = getMsg("tab.general");
int gmnemonic = getVKMnemonic("tab.general");
pnlGeneral = new GeneralPanel();
tpTabs.add(gkey, pnlGeneral);
tpTabs.setMnemonicAt(0, gmnemonic);
String pkey = getMsg("tab.pagesetup");
int pmnemonic = getVKMnemonic("tab.pagesetup");
pnlPageSetup = new PageSetupPanel();
tpTabs.add(pkey, pnlPageSetup);
tpTabs.setMnemonicAt(1, pmnemonic);
String akey = getMsg("tab.appearance");
int amnemonic = getVKMnemonic("tab.appearance");
pnlAppearance = new AppearancePanel();
tpTabs.add(akey, pnlAppearance);
tpTabs.setMnemonicAt(2, amnemonic);
c.add(tpTabs, BorderLayout.CENTER);
updatePanels();
JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
btnApprove = createExitButton("button.print", this);
pnlSouth.add(btnApprove);
getRootPane().setDefaultButton(btnApprove);
btnCancel = createExitButton("button.cancel", this);
handleEscKey(btnCancel);
pnlSouth.add(btnCancel);
c.add(pnlSouth, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
dispose(CANCEL);
}
});
getAccessibleContext().setAccessibleDescription(getMsg("dialog.printtitle"));
setResizable(false);
setLocation(x, y);
pack();
}
示例5: getSelectAttrib
import sun.print.SunPageSelection; //导入依赖的package包/类
private final int getSelectAttrib() {
if (attributes != null) {
SunPageSelection pages =
(SunPageSelection)attributes.get(SunPageSelection.class);
if (pages == SunPageSelection.RANGE) {
return PD_PAGENUMS;
} else if (pages == SunPageSelection.SELECTION) {
return PD_SELECTION;
} else if (pages == SunPageSelection.ALL) {
return PD_ALLPAGES;
}
}
return PD_NOSELECTION;
}
示例6: initPrintDialog
import sun.print.SunPageSelection; //导入依赖的package包/类
/**
* Initialize print dialog.
*/
void initPrintDialog(int x, int y,
PrintService[] services,
int defaultServiceIndex,
DocFlavor flavor,
PrintRequestAttributeSet attributes)
{
this.services = services;
this.defaultServiceIndex = defaultServiceIndex;
this.asOriginal = attributes;
this.asCurrent = new HashPrintRequestAttributeSet(attributes);
this.psCurrent = services[defaultServiceIndex];
this.docFlavor = flavor;
SunPageSelection pages =
(SunPageSelection)attributes.get(SunPageSelection.class);
if (pages != null) {
isAWT = true;
}
Container c = getContentPane();
c.setLayout(new BorderLayout());
tpTabs = new JTabbedPane();
tpTabs.setBorder(new EmptyBorder(5, 5, 5, 5));
String gkey = getMsg("tab.general");
int gmnemonic = getVKMnemonic("tab.general");
pnlGeneral = new GeneralPanel();
tpTabs.add(gkey, pnlGeneral);
tpTabs.setMnemonicAt(0, gmnemonic);
String pkey = getMsg("tab.pagesetup");
int pmnemonic = getVKMnemonic("tab.pagesetup");
pnlPageSetup = new PageSetupPanel();
tpTabs.add(pkey, pnlPageSetup);
tpTabs.setMnemonicAt(1, pmnemonic);
String akey = getMsg("tab.appearance");
int amnemonic = getVKMnemonic("tab.appearance");
pnlAppearance = new AppearancePanel();
tpTabs.add(akey, pnlAppearance);
tpTabs.setMnemonicAt(2, amnemonic);
c.add(tpTabs, BorderLayout.CENTER);
updatePanels();
JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING));
btnApprove = createExitButton("button.print", this);
pnlSouth.add(btnApprove);
getRootPane().setDefaultButton(btnApprove);
btnCancel = createExitButton("button.cancel", this);
handleEscKey(btnCancel);
pnlSouth.add(btnCancel);
c.add(pnlSouth, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
dispose(CANCEL);
}
});
getAccessibleContext().setAccessibleDescription(getMsg("dialog.printtitle"));
setResizable(false);
setLocation(x, y);
pack();
}
示例7: setNativeAttributes
import sun.print.SunPageSelection; //导入依赖的package包/类
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);
}
}
示例8: setNativeAttributes
import sun.print.SunPageSelection; //导入依赖的package包/类
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);
}
}
示例9: setNativeAttributes
import sun.print.SunPageSelection; //导入依赖的package包/类
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);
}
}