//***************************************************************************** // ColorMouseHandler.java // 3/11/00 // Responds to clicks on the color bar, by setting the current color // // // Geetika Tewari, Christie Rice & Vicky Manfredi // //***************************************************************************** import java.awt.*; import java.awt.event.*; import java.lang.*; import java.io.*; import java.util.*; class ColorMouseHandler extends MouseAdapter{ ColorFrame cf; int i, j; //****************************** // // constructor // //****************************** public ColorMouseHandler (ColorFrame cff) { cf = cff; j = 20; }// end constructor //****************************** // // mousePressed // //****************************** public void mousePressed(MouseEvent e) { }// end mousePressed //****************************** // // mouseReleased // //****************************** public void mouseReleased(MouseEvent e) { Point pt = e.getPoint(); j = 20; // If user is selecting a pre-defined color. if (pt.y >= 23 && pt.y <= 38) { for (i = 0; i < 10; i++) { if (pt.x >= j && (pt.x < (j+15))) { cf.curc = cf.StaticColor[i]; }// end if j = j + 15; }// end for }// end if // If user is selecting a user-defined color. if (pt.y >= 42 && pt.y <= 57) { for (i = 0; i < 10; i++) { if (pt.x >= j && (pt.x < (j+15))) { cf.curc = cf.UserColor[i]; }// end if j = j + 15; }// end for }// end if cf.cp.cbp.cc.repaint(); }// end mouseReleased }// end class ColorMouseHandler