/** Paint drop line on glass pane. * @param Graphics g Obtained graphics */ public void paint(Graphics g) { if (line!=null) { // check bounds line = checkLineBounds (line); int x1 = (int)line.getX1 (); int x2 = (int)line.getX2 (); int y1 = (int)line.getY1 (); // int y2 = (int)line.getY2 (); actually not used // LINE g.drawLine (x1+2, y1, x2-2, y1); g.drawLine (x1+2, y1+1, x2-2, y1+1); // RIGHT g.drawLine (x1, y1-2, x1, y1+3); g.drawLine (x1+1, y1-1, x1+1, y1+2); // LEFT g.drawLine (x2, y1-2, x2, y1+3); g.drawLine (x2-1, y1-1, x2-1, y1+2); } // help indication of glass pane for debugging /*g.drawLine (0, getBounds ().height / 2, getBounds ().width, getBounds ().height / 2); g.drawLine (0, getBounds ().height / 2+1, getBounds ().width, getBounds ().height / 2+1); g.drawLine (getBounds ().width / 2, 0, getBounds ().width / 2, getBounds ().height); g.drawLine (getBounds ().width / 2+1, 0, getBounds ().width / 2+1, getBounds ().height); */ } }
/** Paint drop line on glass pane. * @param Graphics g Obtained graphics */ public void paint(Graphics g) { if (line!=null) { // check bounds line = checkLineBounds (line); int x1 = (int)line.getX1 (); int x2 = (int)line.getX2 (); int y1 = (int)line.getY1 (); // int y2 = (int)line.getY2 (); actually not used // LINE g.drawLine (x1+2, y1, x2-2, y1); g.drawLine (x1+2, y1+1, x2-2, y1+1); // RIGHT g.drawLine (x1, y1-2, x1, y1+3); g.drawLine (x1+1, y1-1, x1+1, y1+2); // LEFT g.drawLine (x2, y1-2, x2, y1+3); g.drawLine (x2-1, y1-1, x2-1, y1+2); } // help indication of glass pane for debugging /*g.drawLine (0, getBounds ().height / 2, getBounds ().width, getBounds ().height / 2); g.drawLine (0, getBounds ().height / 2+1, getBounds ().width, getBounds ().height / 2+1); g.drawLine (getBounds ().width / 2, 0, getBounds ().width / 2, getBounds ().height); g.drawLine (getBounds ().width / 2+1, 0, getBounds ().width / 2+1, getBounds ().height); */ } }