Class CyMenuItem

java.lang.Object
org.cytoscape.application.swing.CyMenuItem

public final class CyMenuItem extends Object
A simple wrapper class that allows a JMenuItem to be associated with a gravity value which defines where in a menu the item should fall.

Cytoscape Backwards Compatibility (Final Class): This class is final and therefore can't be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.

Module: swing-application-api

To use this in your app, include the following dependency in your POM:

<dependency>
    <groupId>org.cytoscape</groupId>
    <artifactId>swing-application-api</artifactId>
</dependency>
  • Constructor Details

    • CyMenuItem

      public CyMenuItem(JMenuItem menuItem, float gravity)
      Constructor.
      Parameters:
      menuItem - to JMenuItem to be added to the menu.
      gravity - the gravity of the menu item to be added.
  • Method Details

    • getMenuItem

      public JMenuItem getMenuItem()
      Returns the menu item to be placed in a menu according to the specified menu gravity.
      Returns:
      the menu item to be placed in a menu according to the specified menu gravity.
    • getMenuGravity

      public float getMenuGravity()
      Returns the gravity used to place the menu item in a menu. Gravity is a numeric value associated with each menu item. MenuItems in the same menu pull-down are sorted in ascending order based on their gravity values.
      Returns:
      The gravity used to place the menu item in a menu.