Package java.awt

Examples of java.awt.Graphics.translate()


        Location loc = painter.getLocation();
        int x = loc.getX();
        int y = loc.getY();
        double rotate = 0.0;
        Graphics g = painter.getGraphics();
        g.translate(x, y);
        if (facing != Direction.EAST && g instanceof Graphics2D) {
            rotate = -facing.toRadians();
            ((Graphics2D) g).rotate(rotate);
        }
View Full Code Here


        }

        if (rotate != 0.0) {
            ((Graphics2D) g).rotate(-rotate);
        }
        g.translate(-x, -y);
    }

    //
    // methods for instances
    //
View Full Code Here

    public final void paintIcon(ComponentDrawContext context,
            int x, int y, AttributeSet attrs) {
        InstancePainter painter = context.getInstancePainter();
        painter.setFactory(this, attrs);
        Graphics g = painter.getGraphics();
        g.translate(x, y);
        paintIcon(painter);
        g.translate(-x, -y);

        if (painter.getFactory() == null) {
            Icon i = icon;
View Full Code Here

        InstancePainter painter = context.getInstancePainter();
        painter.setFactory(this, attrs);
        Graphics g = painter.getGraphics();
        g.translate(x, y);
        paintIcon(painter);
        g.translate(-x, -y);

        if (painter.getFactory() == null) {
            Icon i = icon;
            if (i == null) {
                String n = iconName;
View Full Code Here

    public final void drawGhost(ComponentDrawContext context, Color color,
            int x, int y, AttributeSet attrs) {
        InstancePainter painter = context.getInstancePainter();
        Graphics g = painter.getGraphics();
        g.setColor(color);
        g.translate(x, y);
        painter.setFactory(this, attrs);
        paintGhost(painter);
        g.translate(-x, -y);
        if (painter.getFactory() == null) {
            super.drawGhost(context, color, x, y, attrs);
View Full Code Here

        Graphics g = painter.getGraphics();
        g.setColor(color);
        g.translate(x, y);
        painter.setFactory(this, attrs);
        paintGhost(painter);
        g.translate(-x, -y);
        if (painter.getFactory() == null) {
            super.drawGhost(context, color, x, y, attrs);
        }
    }
View Full Code Here

            GraphicsUtil.switchToWidth(g, 1);
            g.setColor(defaultColor);
        }

        Graphics g2 = g.create();
        g2.translate(BORDER, BORDER);
        item.paintIcon(this, g2);
        g2.dispose();

        // draw selection indicator
        if (toolbar.getToolbarModel().isSelected(item)) {
View Full Code Here

            double scale = Math.min(1.0, Math.min(scaleX, scaleY));

            Graphics gCopy = g.create();
            int borderX = (int) ((size.width - bds.getWidth() * scale) / 2);
            int borderY = (int) ((size.height - bds.getHeight() * scale) / 2);
            gCopy.translate(borderX, borderY);
            if (scale != 1.0 && g instanceof Graphics2D) {
                ((Graphics2D) gCopy).scale(scale, scale);
            }
            gCopy.translate(-bds.getX(), -bds.getY());

View Full Code Here

            int borderY = (int) ((size.height - bds.getHeight() * scale) / 2);
            gCopy.translate(borderX, borderY);
            if (scale != 1.0 && g instanceof Graphics2D) {
                ((Graphics2D) gCopy).scale(scale, scale);
            }
            gCopy.translate(-bds.getX(), -bds.getY());

            ComponentDrawContext context = new ComponentDrawContext(this, circuit,
                    circuitState, g, gCopy);
            context.setShowState(false);
            context.setShowColor(false);
View Full Code Here

    public void paintInstance(InstancePainter painter) {
        Location loc = painter.getLocation();
        int x = loc.getX();
        int y = loc.getY();
        Graphics g = painter.getGraphics();
        g.translate(x, y);
        Value pull = getPullValue(painter.getAttributeSet());
        Value actual = painter.getPort(0);
        paintBase(painter, pull, pull.getColor(), actual.getColor());
        g.translate(-x, -y);
        painter.drawPorts();
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.