1. /*
  2. * @(#)MenuElement.java 1.8 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing;
  11. import java.awt.*;
  12. import java.awt.event.*;
  13. /**
  14. * Any component that can be placed into a menu should implement this interface.
  15. * This interface is used by MenuSelection to handle selection and navigation in
  16. * menu hierarchies.
  17. *
  18. * @version 1.8 02/02/00
  19. * @author Arnaud Weber
  20. */
  21. public interface MenuElement {
  22. /**
  23. * Process a mouse event. event is a MouseEvent with source being the receiving element's component.
  24. * path is the path of the receiving element in the menu
  25. * hierarchy including the receiving element itself.
  26. * manager is the MenuSelectionManager for the menu hierarchy.
  27. * This method should process the MouseEvent and change the menu selection if necessary
  28. * by using MenuSelectionManager's API
  29. * Note: you do not have to forward the event to sub-components. This is done automatically
  30. * by the MenuSelectionManager
  31. */
  32. public void processMouseEvent(MouseEvent event,MenuElement path[],MenuSelectionManager manager);
  33. /**
  34. * Process a key event.
  35. */
  36. public void processKeyEvent(KeyEvent event,MenuElement path[],MenuSelectionManager manager);
  37. /**
  38. * Call by the MenuSelection when the MenuElement is added or remove from
  39. * the menu selection.
  40. */
  41. public void menuSelectionChanged(boolean isIncluded);
  42. /**
  43. * This method should return an array containing the sub-elements for the receiving menu element
  44. *
  45. * @return an array of MenuElements
  46. */
  47. public MenuElement[] getSubElements();
  48. /**
  49. * This method should return the java.awt.Component used to paint the receiving element.
  50. * The returned component will be used to convert events and detect if an event is inside
  51. * a MenuElement's component.
  52. *
  53. * @return the Component value
  54. */
  55. public Component getComponent();
  56. }