// Copyright 1996, Marimba Inc. All Rights Reserved.


// @(#)FocusCandidate.java, 1.4, 06/10/96





package marimba.gui;





import marimba.util.Sortable;





/**


 * This is a temporary object for holding widgets that is


 * used to determine the next focus.


 *


 * @author	Arthur van Hoff


 * @version 	1.4, 06/10/96


 */


class FocusCandidate implements Sortable {


    Widget widget;


    int x;


    int y;





    /**


     * Constructor.


     */


    FocusCandidate(Widget widget, int x, int y) {


	this.widget = widget;


	this.x = x + widget.x;


	this.y = y + widget.y;


    }





    /**


     * Compare two focus widgets.


     */


    public int compareTo(Sortable other, Object rock) {


	FocusCandidate w = (FocusCandidate)other;


	if (y < w.y) {


	    return -1;


	}


	if (y > w.y) {


	    return 1;


	}


	if (x < w.x) {


	    return -1;


	}


	if (x > w.x) {


	    return 1;


	}


	return 0;


    }


}


