Class AbstractRegionSelector

    • Constructor Detail

      • AbstractRegionSelector

        protected AbstractRegionSelector​(String name)
    • Method Detail

      • setRegionShape

        public void setRegionShape​(Shape shape)

        Set the region that is being selected with this operation. Any shape can be specified, but if the shape is a rectangle then it has extended functionality: the width or height of the rectangle can be 0 (to select a line or point), or Float.NaN to allow stretching in that dimension. So, for example, to allow the selection of a Rectangle of any size, pass in new Rectangle2D.Float(0, 0, Float.NaN, Float.NaN) (this is also the default value).

        The specified shape is in PDF coordinates, and they will be clipped to the dimensions of the page. The "x" and "y" values of the shape are ignored.

      • createRubberBoxComponent

        protected JComponent createRubberBoxComponent()
        Create the JComponent that it used to display the "rubber box". If you need to display some custom appearance when overriding this class, this method should be overridden.
      • isDirectional

        protected boolean isDirectional()
        Return true if the order of the points passed in to action(org.faceless.pdf2.viewer2.ViewerEvent) matters, or false if they should be normalised to [top-left, bottom-right]. The default is false.
      • paintRubberBandComponent

        public void paintRubberBandComponent​(JComponent component,
                                             Graphics2D g)
        Paint the component while the "rubber band" box is being stretched. This method may be overriden if something is to be painted inside the box during this time.
        component - the "rubber band" box being drawn
        g - the Graphic2D object to draw on.
      • action

        public void action​(PagePanel panel,
                           Point2D start,
                           Point2D end)
        Called when an area of the PDF has been selected.
        panel - the PagePanel the selection was made on.
        start - the start point of the selection, in PDF-units
        end - the end point of the selection, in PDF-units