All pastes #257740 Raw Edit

Mine

public text v1 · immutable
#257740 ·published 2006-11-25 18:32 UTC
rendered paste body
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.URL;
import sun.audio.*;    
import java.io.*;
/* This is the drawing area of the program.  I also made it the center of the program
 *which handles most cross-class updates because it has all of the pointers to each
 *of the objects,making it an easy place to have all cross-class updates.*/
public class aCanvas extends JComponent implements MouseListener{
/*    private allAxis axis;
    private allData data;
    private allDataPoints points,line,histo,scatter;
    private infoArea infoDiv;
    private int curCat,scatterCatX,scatterCatY,filter;
    private Color backgroundColor;
    private allLines lines;*/
   /*When initialized it only needs the info area pointer, otherwise it just loads
    *everything with its starting(default) values.  */
    public aCanvas(/*infoArea i*/){
        
/*
        curCat=0;
        scatterCatX=1;
        scatterCatY=2;
        infoDiv=i;
        filter=-1;
        backgroundColor=Color.LIGHT_GRAY;
        data=new loadRestaurantData();
        axis=new histoAxis(this,data,false);
        histo=new histogramPoints(this,data,0,axis,i);
        line=new linePoints(this,data,0,axis,infoDiv);
        points=histo;
        lines=new allLines(this);*/
        addMouseListener(this);
        repaint();
      }
    /*Calls the draw funtions of the axis and data points because they understand
     *how to drawm themselves, checks to see if they should actually be drawn too
     Draws the background first then allows the others to overwrite ontop of it.*/
    protected void paintComponent(Graphics g){
                Graphics2D g2d = (Graphics2D)g;
        
        

/*        g2d.setColor(getBackground());
        g2d.fill(new Rectangle(0,0,this.getWidth(),this.getHeight()));
        g2d.setColor(Color.black);*/
       g2d.scale(2.0,2.0);
       int height=this.getHeight();
       int width=this.getWidth();
       g.drawLine(0,0, width, height);
       g.drawLine(0,height, width, 0);
        /*if(!axis.hiddenState())
            axis.drawAxis(g);
        if(!data.getHiddenState())
            points.drawData(g);*/
        g2d.scale(1,1);
        setPreferredSize(new Dimension(this.getWidth()*2,this.getHeight()*2));
        
    }
    /*a mouse was clicked, tell the datapoints to handle it*/
    public void mousePressed (MouseEvent event) {       
   /*       if (event.getClickCount() == 2)  
            points.deleteLine(event.getPoint());
          points.doClick(event.getPoint(),event);*/
    }
    public void mouseClicked (MouseEvent event) {
       
    }
    public void mouseReleased (MouseEvent event) {
        //points.doClick(event.getPoint(),event);
    }
    public void mouseEntered (MouseEvent event) {}
    public void mouseExited (MouseEvent event) {}
    
    
}