sun.print.SunPageSelection Java Examples

The following examples show how to use sun.print.SunPageSelection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServiceDialog.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #2
Source File: ServiceDialog.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #3
Source File: ServiceDialog.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #4
Source File: ServiceDialog.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #5
Source File: ServiceDialog.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #6
Source File: ServiceDialog.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #7
Source File: ServiceDialog.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example #8
Source File: ServiceDialog.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #9
Source File: ServiceDialog.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #10
Source File: ServiceDialog.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #11
Source File: ServiceDialog.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #12
Source File: ServiceDialog.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #13
Source File: ServiceDialog.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #14
Source File: ServiceDialog.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #15
Source File: RasterPrinterJob.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #16
Source File: RasterPrinterJob.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #17
Source File: RasterPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #18
Source File: RasterPrinterJob.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #19
Source File: RasterPrinterJob.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #20
Source File: RasterPrinterJob.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #21
Source File: RasterPrinterJob.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #22
Source File: RasterPrinterJob.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #23
Source File: RasterPrinterJob.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #24
Source File: RasterPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #25
Source File: RasterPrinterJob.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #26
Source File: RasterPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #27
Source File: PrintJob2D.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void updateAttributes() {
    Copies c = (Copies)attributes.get(Copies.class);
    jobAttributes.setCopies(c.getValue());

    SunPageSelection sel =
        (SunPageSelection)attributes.get(SunPageSelection.class);
    if (sel == SunPageSelection.RANGE) {
        jobAttributes.setDefaultSelection(DefaultSelectionType.RANGE);
    } else if (sel == SunPageSelection.SELECTION) {
        jobAttributes.setDefaultSelection(DefaultSelectionType.SELECTION);
    } else {
        jobAttributes.setDefaultSelection(DefaultSelectionType.ALL);
    }

    Destination dest = (Destination)attributes.get(Destination.class);
    if (dest != null) {
        jobAttributes.setDestination(DestinationType.FILE);
        jobAttributes.setFileName(dest.getURI().getPath());
    } else {
        jobAttributes.setDestination(DestinationType.PRINTER);
    }

    PrintService serv = printerJob.getPrintService();
    if (serv != null) {
        jobAttributes.setPrinter(serv.getName());
    }

    PageRanges range = (PageRanges)attributes.get(PageRanges.class);
    int[][] members = range.getMembers();
    jobAttributes.setPageRanges(members);

    SheetCollate collation =
        (SheetCollate)attributes.get(SheetCollate.class);
    if (collation == SheetCollate.COLLATED) {
        jobAttributes.setMultipleDocumentHandling(
        MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES);
    } else {
        jobAttributes.setMultipleDocumentHandling(
        MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES);
    }

    Sides sides = (Sides)attributes.get(Sides.class);
    if (sides == Sides.TWO_SIDED_LONG_EDGE) {
        jobAttributes.setSides(SidesType.TWO_SIDED_LONG_EDGE);
    } else if (sides == Sides.TWO_SIDED_SHORT_EDGE) {
        jobAttributes.setSides(SidesType.TWO_SIDED_SHORT_EDGE);
    } else {
        jobAttributes.setSides(SidesType.ONE_SIDED);
    }

    // PageAttributes

    Chromaticity color =
        (Chromaticity)attributes.get(Chromaticity.class);
    if (color == Chromaticity.COLOR) {
        pageAttributes.setColor(ColorType.COLOR);
    } else {
        pageAttributes.setColor(ColorType.MONOCHROME);
    }

    OrientationRequested orient =
        (OrientationRequested)attributes.get(OrientationRequested.class);
    if (orient == OrientationRequested.LANDSCAPE) {
        pageAttributes.setOrientationRequested(
                                   OrientationRequestedType.LANDSCAPE);
    } else {
        pageAttributes.setOrientationRequested(
                                   OrientationRequestedType.PORTRAIT);
    }

    PrintQuality qual = (PrintQuality)attributes.get(PrintQuality.class);
    if (qual == PrintQuality.DRAFT) {
        pageAttributes.setPrintQuality(PrintQualityType.DRAFT);
    } else if (qual == PrintQuality.HIGH) {
        pageAttributes.setPrintQuality(PrintQualityType.HIGH);
    } else { // NORMAL
        pageAttributes.setPrintQuality(PrintQualityType.NORMAL);
    }

    Media msn = (Media)attributes.get(Media.class);
    if (msn != null && msn instanceof MediaSizeName) {
        MediaType mType = unMapMedia((MediaSizeName)msn);

        if (mType != null) {
            pageAttributes.setMedia(mType);
        }
    }
    debugPrintAttributes(false, false);
}
 
Example #28
Source File: ServiceDialog.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
}
 
Example #29
Source File: ServiceDialog.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
}
 
Example #30
Source File: WPrinterJob.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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);
    }
}