Package java.awt

Examples of java.awt.Graphics2D.translate()


            Shape thumbShape = createThumbShape(w - 1, h - 1);

            // Draw thumb.
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.translate(knobBounds.x, knobBounds.y);

            g2d.setColor(Color.CYAN);
            g2d.fill(thumbShape);

            g2d.setColor(Color.BLUE);
View Full Code Here


            Shape thumbShape = createThumbShape(w - 1, h - 1);

            // Draw thumb.
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.translate(knobBounds.x, knobBounds.y);

            g2d.setColor(Color.PINK);
            g2d.fill(thumbShape);

            g2d.setColor(Color.RED);
View Full Code Here

            Shape thumbShape = createThumbShape(w - 1, h - 1);

            // Draw thumb.
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.translate(knobBounds.x, knobBounds.y);

            g2d.setColor(Color.CYAN);
            g2d.fill(thumbShape);

            g2d.setColor(Color.BLUE);
View Full Code Here

            Shape thumbShape = createThumbShape(w - 1, h - 1);

            // Draw thumb.
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.translate(knobBounds.x, knobBounds.y);

            g2d.setColor(Color.PINK);
            g2d.fill(thumbShape);

            g2d.setColor(Color.RED);
View Full Code Here

                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 2: // <->
                dx = (double)dim.width / (double)w;
                dy = (double)dim.height / (double)h;
                d = Math.min(dx, dy);
View Full Code Here

                break;
            case 2: // <->
                dx = (double)dim.width / (double)w;
                dy = (double)dim.height / (double)h;
                d = Math.min(dx, dy);
                g2d.translate(w*d, 0);
                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);
View Full Code Here

                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 3: // 180�
                dx = (double)dim.width / (double)w;
                dy = (double)dim.height / (double)h;
                d = Math.min(dx, dy);
View Full Code Here

            case 3: // 180�
                dx = (double)dim.width / (double)w;
                dy = (double)dim.height / (double)h;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI);
                g2d.translate(-w*d, -h*d);
                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);
View Full Code Here

                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 4: // 180� + <->
                dx = (double)dim.width / (double)w;
                dy = (double)dim.height / (double)h;
                d = Math.min(dx, dy);
View Full Code Here

            case 4: // 180� + <->
                dx = (double)dim.width / (double)w;
                dy = (double)dim.height / (double)h;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI);
                g2d.translate(0, -h*d);
                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);
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.