java.awt.PopupMenu.show()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(159)

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

PopupMenu.show介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public boolean onOptionsItemSelected(MenuItem item) {
  // ...

  View menuItemView = findViewById(R.id.menu_overflow); // SAME ID AS MENU ID
  PopupMenu popupMenu = new PopupMenu(this, menuItemView); 
  popupMenu.inflate(R.menu.counters_overflow);
  // ...
  popupMenu.show();
  // ...
  return true;
}

代码示例来源:origin: stackoverflow.com

PopupMenu popup = new PopupMenu(mContext, view);

try {
  Field[] fields = popup.getClass().getDeclaredFields();
  for (Field field : fields) {
    if ("mPopup".equals(field.getName())) {
      field.setAccessible(true);
      Object menuPopupHelper = field.get(popup);
      Class<?> classPopupHelper = Class.forName(menuPopupHelper
          .getClass().getName());
      Method setForceIcons = classPopupHelper.getMethod(
          "setForceShowIcon", boolean.class);
      setForceIcons.invoke(menuPopupHelper, true);
      break;
    }
  }
} catch (Exception e) {
  e.printStackTrace();
}

prepareMenu(popup.getMenu());
popup.show();

代码示例来源:origin: stackoverflow.com

public void showPopup(View v) {
  PopupMenu popup = new PopupMenu(this, v);
  MenuInflater inflater = popup.getMenuInflater();
  inflater.inflate(R.menu.actions, popup.getMenu());
  popup.show();
}

代码示例来源:origin: stackoverflow.com

PopupMenu popupMenu = new PopupMenu(context, overflowMenuButton);
 popupMenu.inflate(R.menu.my_menu);
 // Fix vertical offset
 overflowMenuButton.setOnClickListener(new OnClickListener()
 {
   @Override
   public void onClick(View v)
   {
     popupMenu.show();
     if (popupMenu.getDragToOpenListener() instanceof ListPopupWindow.ForwardingListener)
     {
       ListPopupWindow.ForwardingListener listener = (ListPopupWindow.ForwardingListener) popupMenu.getDragToOpenListener();
       listener.getPopup().setVerticalOffset(-overflowMenuButton.getHeight());
       listener.getPopup().show();
     }
   }
 });

代码示例来源:origin: stackoverflow.com

popup.show(); //showing popup menu

代码示例来源:origin: stackoverflow.com

popup.getMenuInflater().inflate(R.menu.clipboard_popup,
    popup.getMenu());
popup.show();
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  @Override

代码示例来源:origin: stackoverflow.com

public void onPopupButtonClick(View button) {
  PopupMenu popup = new PopupMenu(this, button);
  popup.getMenuInflater().inflate(R.menu.popup, popup.getMenu());

  popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
    public boolean onMenuItemClick(MenuItem item) {
      Toast.makeText(PopupMenu1.this, "Clicked popup menu item " + item.getTitle(),
        Toast.LENGTH_SHORT).show();
      return true;
    }
  });

  popup.show();
}

代码示例来源:origin: stackoverflow.com

PopupMenu menu = new PopupMenu(this, view);

menu.getMenu().add("titleRes");
menu.show();

代码示例来源:origin: stackoverflow.com

public void showPopup(){
  View menuItemView = findViewById(R.id.menu_save);
  PopupMenu popup = new PopupMenu(getActivity(), menuItemView);
  MenuInflater inflate = popup.getMenuInflater();
  inflate.inflate(R.menu.popup, popup.getMenu());
  popup.show();

}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

  switch (item.getItemId()) {
  case R.id.menu_save:    
    showPopup();
    return true;
  default:
    return super.onOptionsItemSelected(item);
}

}

代码示例来源:origin: stackoverflow.com

popupMenu.show();

代码示例来源:origin: stackoverflow.com

popup.show();//showing popup menu

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

@Override
 public void actionPerformed(ActionEvent e) {
  pluginPopup.show(copyB, 0, 0);
 }
});

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

@Override
 public void actionPerformed(ActionEvent e) {
  pluginPopup.show(copyB, 0, 0);
 }
});

代码示例来源:origin: net.imagej/ij

public void mousePressed (MouseEvent e) {
  int x=e.getX(), y=e.getY();
  if (e.isPopupTrigger() || e.isMetaDown())
    pm.show(e.getComponent(),x,y);
}

代码示例来源:origin: stackoverflow.com

if (e.getButton() == MouseEvent.BUTTON1) {
  frame.add(popup);
  popup.show(frame, e.getXOnScreen(), e.getYOnScreen());

代码示例来源:origin: stackoverflow.com

public void showPopup(View v) {
  PopupMenu popup = new PopupMenu(this, v);
  MenuInflater inflater = popup.getMenuInflater();
  inflater.inflate(R.menu.actions, popup.getMenu());
  popup.show();
}

代码示例来源:origin: stackoverflow.com

public void showPopup(View v) {
  PopupMenu popup = new PopupMenu(this, v);
  MenuInflater inflater = popup.getMenuInflater();
  inflater.inflate(R.layout.menu, popup.getMenu());
  popup.show();
}

代码示例来源:origin: stackoverflow.com

PopupMenu popupMenu = new PopupMenu(
     context,
     anchorView);
 popupMenu.inflate(R.menu.my_menu);
 popupMenu.setOnMenuItemClickListener(listener);
 popupMenu.show();

代码示例来源:origin: net.imagej/ij

public void actionPerformed(ActionEvent e) {
  String command = e.getActionCommand();
  if (command==null) return;
  if (command.equals(moreLabel)) {
    Point bloc = moreButton.getLocation();
    pm.show(this, bloc.x, bloc.y);
  } else if (command.equals("Convert to RGB"))
    IJ.doCommand("Stack to RGB");
  else
    IJ.doCommand(command);
}

代码示例来源:origin: stackoverflow.com

PopupMenu popupMenu = new PopupMenu(FullMenuActivity.this, view);                      
popupMenu.setOnMenuItemClickListener(FullMenuActivity.this);
popupMenu.getMenu().add(1, R.id.slot1, 1, "slot1");
popupMenu.getMenu().add(1,R.id.slot2,2,"slot2");
popupMenu.getMenu().add(1,R.id.slot3,3,"slot3");
popupMenu.show();

相关文章