java.awt.MenuItem.setLabel()方法的使用及代码示例

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

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

暂无

代码示例

代码示例来源:origin: RipMeApp/ripme

@Override
  public void windowIconified(WindowEvent e)   { trayMenuMain.setLabel("Show"); }
});

代码示例来源:origin: RipMeApp/ripme

@Override
public void windowDeiconified(WindowEvent e) { trayMenuMain.setLabel("Hide"); }
@Override

代码示例来源:origin: RipMeApp/ripme

@Override
public void windowDeactivated(WindowEvent e) { trayMenuMain.setLabel("Show"); }
@Override

代码示例来源:origin: RipMeApp/ripme

@Override
public void windowActivated(WindowEvent e)   { trayMenuMain.setLabel("Hide"); }
@Override

代码示例来源:origin: igniterealtime/Openfire

@Override
  public void windowIconified(WindowEvent e) {
    // Make the window disappear when minimized
    frame.setVisible(false);
    showMenuItem.setLabel("Show");
  }
});

代码示例来源:origin: igniterealtime/Openfire

private void toggleVisibility(MenuItem showMenuItem) {
  // Hide/Unhide the window if the user clicked in the system tray icon or
  // selected the menu option
  if (frame.isVisible()) {
    frame.setVisible(false);
    showMenuItem.setLabel("Show");
  } else {
    frame.setVisible(true);
    frame.setState(Frame.NORMAL);
    showMenuItem.setLabel("Hide");
  }
}

代码示例来源:origin: RipMeApp/ripme

private void toggleTrayClick() {
  if (mainFrame.getExtendedState() == JFrame.ICONIFIED
      || !mainFrame.isActive()
      || !mainFrame.isVisible()) {
    mainFrame.setVisible(true);
    mainFrame.setAlwaysOnTop(true);
    mainFrame.setAlwaysOnTop(false);
    trayMenuMain.setLabel("Hide");
  } else {
    mainFrame.setVisible(false);
    trayMenuMain.setLabel("Show");
  }
}

代码示例来源:origin: com.dorkbox/SystemTray

@Override
  public
  void run() {
    _native.setLabel(menuItem.getText());
  }
});

代码示例来源:origin: i2p/i2p.i2p

String oldStatus = item.getLabel();
if (!status.equals(oldStatus))
  item.setLabel(status);

代码示例来源:origin: Slowpoke101/FTBLaunch

public void updateLocale () {
  killMCButton.setLabel(I18N.getLocaleString("KILL_MC"));
  threadDumpMCButton.setLabel(I18N.getLocaleString("TD_MC"));
  quitButton.setLabel(I18N.getLocaleString("TRAY_QUIT"));
  ftbWebsite.setLabel(I18N.getLocaleString("TRAY_FTB_WEBSITE"));
  showConsole.setLabel(I18N.getLocaleString("SHOW_CONSOLE"));
}

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the DestroyMenuItem property value.
 * @return java.awt.MenuItem
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.MenuItem getDestroyMenuItem() {
  if (ivjDestroyMenuItem == null) {
    try {
      ivjDestroyMenuItem = new java.awt.MenuItem();
      ivjDestroyMenuItem.setLabel("Destroy POA");
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
  };
  return ivjDestroyMenuItem;
}
/**

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the DeactivateMenuItem property value.
 * @return java.awt.MenuItem
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.MenuItem getDeactivateMenuItem() {
if (ivjDeactivateMenuItem == null) {
    try {
      ivjDeactivateMenuItem = new java.awt.MenuItem();
      ivjDeactivateMenuItem.setLabel("Deactivate Object");
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
};
return ivjDeactivateMenuItem;
}
java.awt.Label _getFirstLabel() {

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the RemoveMenuItem property value.
 * @return java.awt.MenuItem
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.MenuItem getRemoveMenuItem() {
if (ivjRemoveMenuItem == null) {
    try {
      ivjRemoveMenuItem = new java.awt.MenuItem();
      ivjRemoveMenuItem.setLabel("Remove Request from Queue");
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
};
return ivjRemoveMenuItem;
}
/**

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the CloseMenuItem property value.
 * @return java.awt.MenuItem
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.MenuItem getCloseMenuItem() {
  if (ivjCloseMenuItem == null) {
    try {
      ivjCloseMenuItem = new java.awt.MenuItem();
      ivjCloseMenuItem.setLabel("Close Monitor");
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
  };
  return ivjCloseMenuItem;
}
/**

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the OpenMenuItem property value.
 * @return java.awt.MenuItem
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.MenuItem getOpenMenuItem() {
  if (ivjOpenMenuItem == null) {
    try {
      ivjOpenMenuItem = new java.awt.MenuItem();
      ivjOpenMenuItem.setLabel("Open Monitor");
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
  };
  return ivjOpenMenuItem;
}
/**

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

/** Changes the name of an item in the Window menu. */
public static synchronized void updateWindowMenuItem(ImagePlus imp, String oldLabel, String newLabel) {
  if (oldLabel==null || newLabel==null)
    return;
  int first = WINDOW_MENU_ITEMS;
  int count = window.getItemCount();
  try {  // workaround for Linux/Java 5.0/bug
    for (int i=first; i<count; i++) {
      MenuItem item = window.getItem(i);
      String label = item.getLabel();
      if (imp!=null) {  //remove size (e.g. " 24MB")
        int index = label.lastIndexOf(" ");
        if (index>-1)
          label = label.substring(0, index);
      }
      if (item!=null && label.equals(oldLabel)) {
        String size = "";
        if (imp!=null)
          size =  " " + ImageWindow.getImageSize(imp);
        item.setLabel(newLabel+size);
        return;
      }
    }
  } catch (Exception e) {}
}

代码示例来源:origin: com.dorkbox/SystemTray

@Override
  public
  void run() {
    Font font = _native.getFont();
    if (font == null) {
      font = new Font(DIALOG, Font.BOLD, 12); // the default font used for dialogs.
    }
    else {
      font = font.deriveFont(Font.BOLD);
    }
    _native.setFont(font);
    _native.setLabel(menuItem.getText());
    // this makes sure it can't be selected
    _native.setEnabled(false);
  }
});

代码示例来源:origin: Slowpoke101/FTBLaunch

public TrayMenu () {
  super();
  killMCButton.setLabel(I18N.getLocaleString("KILL_MC"));
  threadDumpMCButton.setLabel(I18N.getLocaleString("TD_MC"));
  quitButton.setLabel(I18N.getLocaleString("TRAY_QUIT"));
  ftbWebsite.setLabel(I18N.getLocaleString("TRAY_FTB_WEBSITE"));
  showConsole.setLabel(I18N.getLocaleString("SHOW_CONSOLE"));
  this.add(this.killMCButton);
  this.add(this.threadDumpMCButton);
  this.addSeparator();
  this.add(this.showConsole);
  this.addSeparator();
  this.add(this.ftbWebsite);
  this.add(this.quitButton);
}

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the InspectionMenuItem property value.
 * @return java.awt.MenuItem
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.MenuItem getInspectionMenuItem() {
if (ivjInspectionMenuItem == null) {
    try {
      ivjInspectionMenuItem = new java.awt.MenuItem();
      ivjInspectionMenuItem.setEnabled(true);
      ivjInspectionMenuItem.setLabel("Inspect Request Object");
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
};
return ivjInspectionMenuItem;
}
/**

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the InspectionMenuItem property value.
 * @return java.awt.MenuItem
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.MenuItem getInspectionMenuItem() {
if (ivjInspectionMenuItem == null) {
    try {
      ivjInspectionMenuItem = new java.awt.MenuItem();
      ivjInspectionMenuItem.setEnabled(true);
      ivjInspectionMenuItem.setLabel("Inspect Servant Class");
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
};
return ivjInspectionMenuItem;
}
/**

相关文章