mCue = null;
}
if (mCue != null) {
Point p = e.getLocation();
Rectangle rect = mCue.getVisibleRect();
int i = mCue.locationToIndex(p);
if(i != -1) {
Rectangle listRect = mCue.getCellBounds(mCue.locationToIndex(p),
mCue.locationToIndex(p));
Graphics2D g2 = (Graphics2D) mCue.getGraphics();
boolean paint = false;
if(listRect != null) {
listRect.setSize(listRect.width,listRect.height/2);
if(!listRect.contains(e.getLocation()) && !mSwitched && i == mOldIndex) {
mCue.paintImmediately(mCueLine.getBounds());
mCueLine.setRect(0,listRect.y + (listRect.height * 2) - 1,listRect.width,2);
mSwitched = true;
paint = true;
}
else if(listRect.contains(e.getLocation()) && i == mOldIndex && mSwitched) {
mCue.paintImmediately(mCueLine.getBounds());
mCueLine.setRect(0,listRect.y - 1,listRect.width,2);
mSwitched = false;
paint = true;
}
else if(i != mOldIndex && listRect.contains(e.getLocation())) {
mCue.paintImmediately(mCueLine.getBounds());
mCueLine.setRect(0,listRect.y - 1,listRect.width,2);
mSwitched = false;
mOldIndex = i;
paint = true;
}
else if(i != mOldIndex && !listRect.contains(e.getLocation())) {
mCue.paintImmediately(mCueLine.getBounds());
mCueLine.setRect(0,listRect.y + (listRect.height * 2) - 1,listRect.width,2);
mSwitched = true;
mOldIndex = i;
paint = true;
}
if(paint) {
Color c = new Color(255,0,0,180);
g2.setColor(c);
g2.fill(mCueLine);
}
}
}
else {
mOldIndex = -1;
mCue.paintImmediately(mCueLine.getBounds());
}
if(p.y + 20 > rect.y + rect.height) {
mCue.scrollRectToVisible(new Rectangle(p.x,p.y + 15,1,1));
}
if(p.y - 20 < rect.y) {
mCue.scrollRectToVisible(new Rectangle(p.x,p.y - 15,1,1));
}
}
}