[Thinlet-development] thinlet/src/java/thinlet Thinlet.java,1.18,1.19
Brought to you by:
bajzat
From: Stephen C. <sco...@us...> - 2004-10-05 21:02:56
|
Update of /cvsroot/thinlet/thinlet/src/java/thinlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12003/src/java/thinlet Modified Files: Thinlet.java Log Message: Refactor checkLocation to take the component as a parameter This separates mouseinside handling from other methods, and saves 22 bytes Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/java/thinlet/Thinlet.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Thinlet.java 5 Oct 2004 20:57:28 -0000 1.18 +++ Thinlet.java 5 Oct 2004 21:02:44 -0000 1.19 @@ -553,10 +553,8 @@ } i++; } - if (mouseinside == component) { // layout changed, check the hovered - // tab - checkLocation(); - } + // layout changed, check the hovered tab + checkLocation(component); return; } boolean horizontal = ((placement == "top") || (placement == "bottom")); @@ -601,10 +599,8 @@ } } } - if (mouseinside == component) { // layout changed, check the hovered - // tab - checkLocation(); - } + // layout changed, check the hovered tab + checkLocation(component); } } @@ -769,9 +765,7 @@ removeItemImpl(content, popup); set(popup, ":parent", null); set(component, ":popup", null); - if (mouseinside == popup) { - checkLocation(); - } + checkLocation(popup); popupMenu(popup); // remove recursively } // pop up the selected menu only @@ -913,9 +907,7 @@ repaint(combolist); set(combolist, ":parent", null); popupowner = null; - if (mouseinside == combolist) { - checkLocation(); - } + checkLocation(combolist); } /** @@ -2930,12 +2922,15 @@ } /** - * Check the previous mouse location again because of a possible layout - * change + * Check the previous mouse location again because of a possible layout change. + * + * @param component the component to check */ - private void checkLocation() { - findComponent(content, mousex, mousey); - handleMouseEvent(mousex, mousex, 1, false, false, false, MouseEvent.MOUSE_ENTERED, mouseinside, insidepart); + private void checkLocation(Object component) { + if (mouseinside == component) { + findComponent(content, mousex, mousey); + handleMouseEvent(mousex, mousex, 1, false, false, false, MouseEvent.MOUSE_ENTERED, mouseinside, insidepart); + } } /** |