Package org.jpedal.examples.simpleviewer.paper

Examples of org.jpedal.examples.simpleviewer.paper.MarginPaper


        ChangeListener marginListener = new ChangeListener() {
            static final double mmToSubInch = 72 / 25.4;

            public void stateChanged(ChangeEvent e) {
                MarginPaper paper = getSelectedPaper();
                if (paper==null)
                    return;

                double l = (Double) left.getValue() *mmToSubInch;
                double r = (Double) right.getValue() *mmToSubInch;
                double t = (Double) top.getValue() *mmToSubInch;
                double b = (Double) bottom.getValue() *mmToSubInch;
                paper.setImageableArea(l, t, (paper.getWidth()-l)-r, (paper.getHeight()-t)-b);
                updatePreview();
            }
        };
        left.addChangeListener(marginListener);
        right.addChangeListener(marginListener);
View Full Code Here


        return indexToUse;
    }

    private void updateMargins() {

        MarginPaper p = getSelectedPaper();

        if (p==null)
            return;

        //Update minimum values
        ((CustomSpinnerModel)left.getModel()).setMinValue(p.getMinX()*mmPerSubInch);
        ((CustomSpinnerModel)top.getModel()).setMinValue(p.getMinY()*mmPerSubInch);
        ((CustomSpinnerModel)right.getModel()).setMinValue((p.getWidth()-p.getMaxRX())*mmPerSubInch);
        ((CustomSpinnerModel)bottom.getModel()).setMinValue((p.getHeight()-p.getMaxBY())*mmPerSubInch);


        //Set values to min
        Double a = (double) 0;
        left.setValue(a);
View Full Code Here

            iW = pW;                                                                //Imageable area width
            iH = pH;                                                                //Imageable area height
            iX = 0;                                                                 //Imageable area start x
            iY = 0;                                                                 //Imageable area start y
        } else {
            MarginPaper p = paperDefinitions.getSelectedPaper(pageSize.getSelectedItem());
            if (p==null) {
                g2.drawString(Messages.getMessage("PdfPrintPreview.Loading"), (w/2)-25, (h/2)-5);
                return;
            }
            pW = (int)p.getWidth();
            pH = (int)p.getHeight();
            iX = (int)p.getImageableX();
            iY = (int)p.getImageableY();
            iW = (int)p.getImageableWidth();
            iH = (int)p.getImageableHeight();
        }

        //check auto rotate
        if (autoRotateCenter.isSelected() && ((pageWidth>pageHeight && iW<iH) || (pageWidth<pageHeight && iW>iH))) {
            int temp;
View Full Code Here

TOP

Related Classes of org.jpedal.examples.simpleviewer.paper.MarginPaper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.