Package java.awt

Examples of java.awt.Graphics2D.translate()


                g2d.scale(-d, d);
                if ((int)(w*d + .5) < dim.width)
                    xOffset = (int)((dim.width - w*d)/(2.0*d) + 0.5);
                if ((int)(h*d + .5) < dim.height)
                    yOffset = (int)((dim.height - h*d)/(2.0*d) + 0.5);
                g2d.translate(xOffset, -yOffset);
               break;
            case 5: // -90� + <->
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
View Full Code Here


                g2d.scale(d, -d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
                g2d.translate(yOffset, xOffset);
                break;
            case 6: // -90�
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
View Full Code Here

            case 6: // -90�
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI/2);
                g2d.translate(0, -h*d);
                g2d.scale(d, d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
View Full Code Here

                g2d.scale(d, d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
                g2d.translate(yOffset, -xOffset);
                break;
            case 7: // 90� + <->
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
View Full Code Here

            case 7: // 90� + <->
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(-Math.PI/2);
                g2d.translate(-w*d, h*d);
                g2d.scale(d, -d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
View Full Code Here

                g2d.scale(d, -d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
                g2d.translate(-yOffset, -xOffset);
                break;
            case 8: // 90�
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
View Full Code Here

            case 8: // 90�
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(-Math.PI/2);
                g2d.translate(-w*d, 0);
                g2d.scale(d, d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
View Full Code Here

                g2d.scale(d, d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
                g2d.translate(yOffset, xOffset);
                break;
        }
    }
   
    public boolean doPaint(Graphics g, Dimension dim, boolean bPrint)
View Full Code Here

        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            setCurrentDimension();
            Graphics2D g2d = (Graphics2D) g;
            g2d.translate(0, currentHeight);
            g2d.scale(1, -1);
            drawHisto(g2d);
            g2d.dispose();
        }
View Full Code Here

      protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D) g.create();
        //shift the image for pressed buttons
        if (getModel().isPressed()) {
          g2.translate(1, 1);
        }
        g2.setStroke(new BasicStroke(2));
        g2.setColor(Color.BLACK);
        if (!isEnabled()) {
          g2.setColor(Color.GRAY);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.