home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 642 b | 37 lines |
- // Buttons.java
- // 29.03.96
- //
- // A group of buttons
-
- package cybcerone.utils;
-
- import java.util.Vector;
- import java.util.Enumeration;
-
- /**
- * Searchable group of buttons.
- */
- public class Buttons {
- private Vector theButtons;
-
- public Buttons () {
- theButtons = new Vector ();
- }
-
- public void addButton (Button newButton) {
- theButtons.addElement (newButton);
- }
-
- public Button which (int x, int y) {
- Button theButton;
-
- for (Enumeration e = theButtons.elements ();
- e.hasMoreElements ();) {
- theButton = (Button)e.nextElement ();
- if (theButton.inside (x, y))
- return theButton;
- }
- return null;
- }
- }
-