/*
 * LinePaintable.java
 *
 * Created on June 18, 2007, 6:07 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package control;

import java.awt.Color;
import java.awt.Graphics2D;

/**
 *
 * @author Home
 */
public class LinePaintable implements Paintable
{
    
    Color color;
    double x;
    double y;
    double x2;
    double y2;
    Screen screen;
    /** Creates a new instance of LinePaintable */
    public LinePaintable( Screen s, Color c, double dx, double dx2, double dy, double dy2 )
    {
        color = c;
        
        x = dx;
        y = dy;
        x2 = dx2;
        y2 = dy2;
        
        screen = s;
        
        screen.addPaintable( this );
    }
    
    public void paint( Graphics2D g )
    {
        g.setColor( color );
        g.drawLine( (int) x, (int) x2, (int) y, (int) y2 );
    }
    
    public void repositionLine( double dx, double dx2, double dy, double dy2 )
    {
        x = dx;
        y = dy;
        x2 = dx2;
        y2 = dy2;
    }
    
    public void setColor( Color c )
    {
        color = c;
    }
    public Color getColor()
    {
        return color;
    }
    
}
