javafx.scene.control.MenuItem.getId()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中javafx.scene.control.MenuItem.getId()方法的一些代码示例,展示了MenuItem.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem.getId()方法的具体详情如下:
包路径:javafx.scene.control.MenuItem
类名称:MenuItem
方法名:getId

暂无

代码示例

代码示例来源:origin: com.vektorsoft.demux.desktop/demux-jfx-core

@Override
public int compare(MenuItem o1, MenuItem o2) {
  int i1 = -1;
  if (o1.getId() != null) {
    i1 = indexMap.get(o1.getId());
  }
  if (i1 < 0) {
    i1 = Integer.MAX_VALUE;
  }
  int i2 = -1;
  if (o2.getId() != null) {
    i2 = indexMap.get(o2.getId());
  }
  if (i2 < 0) {
    i2 = Integer.MAX_VALUE;
  }
  return Integer.compare(i1, i2);
}

代码示例来源:origin: com.vektorsoft.demux.desktop/demux-jfx-core

private void addDeferredMenu(MenuItem menu) {
  String id = menu.getId();
  if (deferredItems.containsKey(id)) {
    deferredItems.get(id).add(menu);
  } else {
    Set<MenuItem> items = new HashSet<>();
    items.add(menu);
    deferredItems.put(id, items);
  }
}

代码示例来源:origin: com.vektorsoft.demux.desktop/demux-jfx-core

/**
 * Returns menu item with ID {@code id} contained within {@code menu}.
 * 
 * @param menu parent menu of menu item
 * @param id menu item ID
 * @return menu item, or {@code null} if none is found
 */
private static MenuItem findMenuItemById(Menu menu, String id){
  MenuItem result = null;
  List<MenuItem> items = menu.getItems();
  for(MenuItem item : items){
    if(item.getId() != null && item.getId().equals(id)){
      result =  item;
      break;
    } else {
      if(item instanceof Menu){
        result = findMenuItemById((Menu)item, id);
        if(result != null){
          break;
        }
      }
    }
    
  }
  return result;
}

代码示例来源:origin: com.vektorsoft.demux.desktop/demux-jfx-core

if (item.getId() == null || item.getId().isEmpty() || !compId.equals(item.getId())) {
  throw new IllegalArgumentException("Invalid ID for component" + item + ". It must match " + compId);

代码示例来源:origin: com.bitplan.radolan/com.bitplan.radolan

if (source instanceof MenuItem) {
 MenuItem menuItem = (MenuItem) source;
 switch (menuItem.getId()) {
 case RadolanI18n.FILE_MENU__QUIT_MENU_ITEM:
  close();
  break;
 default:
  LOGGER.log(Level.WARNING, "unhandled menu item " + menuItem.getId()
    + ":" + menuItem.getText());

相关文章