Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Java by jossava ( 9 years ago )
public void paintComponent(Graphics g) {
        super.paintComponent(g);

        Graphics2D g2d = (Graphics2D) g;

        g2d.setColor(Color.black);

        // size es el tamaño de la ventana.
        Dimension size = getSize();
        // Insets son los bordes y los títulos de la ventana.
        Insets insets = getInsets();

        int w = size.width - insets.left - insets.right;
        int h = size.height - insets.top - insets.bottom;

        width = w;
        height = h;

        /*for (int angle = 0; angle < 360; angle += STEP) {
            double angleD = angle * Math.PI / 180d;
            MyPoint p1 = new MyPoint(0, 0);
            MyPoint p2 = new MyPoint(
                    (int) (R * Math.cos(angleD)),
                    (int) (R * Math.sin(angleD))
            );
            drawBresenhamLine3(g2d, p1, p2);
        }*/
        for (double x1 = -15; x1 < 15; x1 += 1) {
            int y1 = (int)(Math.pow(x1, 2));
            int x2 = (int)x1+1;
            int y2 = (int)(Math.pow(x2, 2));
            MyPoint p1 = new MyPoint((int)x1*15, y1);
            MyPoint p2 = new MyPoint((int)x2*15, y2);
            drawBresenhamLine3(g2d, p1, p2);
        }
        for (double x1 = -15; x1 < 6; x1 += 1) {
            int y1 = (int)(Math.pow(x1, 2));
            int x2 = (int)x1+8;
            int y2 = (int)(Math.pow(x2, 2));
            MyPoint p1 = new MyPoint((int)x1*15, y1);
            MyPoint p2 = new MyPoint((int)x2*15, y2);
            drawBresenhamLine3(g2d, p1, p2);
        }

    }

 

Revise this Paste

Your Name: Code Language: