javax.swing.JMenu.setEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(173)

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

JMenu.setEnabled介绍

暂无

代码示例

代码示例来源:origin: deathmarine/Luyten

public void updateRecentFiles() {
  if (RecentFiles.paths.isEmpty()) {
    recentFiles.setEnabled(false);
    clearRecentFiles.setEnabled(false);
    return;
  } else {
    recentFiles.setEnabled(true);
    clearRecentFiles.setEnabled(true);

代码示例来源:origin: apache/pdfbox

/**
 * Set if the menu should be enabled or disabled.
 *
 * @param isEnable boolean instance.
 */
public void setEnableMenu(boolean isEnable)
{
  menu.setEnabled(isEnable);
}

代码示例来源:origin: apache/pdfbox

private JMenu createFindMenu()
  findMenu.setEnabled(false);

代码示例来源:origin: apache/pdfbox

public void addMenuListeners(PDFDebugger frame)
{
  frame.getFindMenu().setEnabled(true);
  frame.getFindMenuItem().addActionListener(findAction);
  frame.getFindNextMenuItem().addActionListener(nextAction);
  frame.getFindPreviousMenuItem().addActionListener(previousAction);
}

代码示例来源:origin: apache/pdfbox

@Override
public void ancestorAdded(AncestorEvent ancestorEvent)
{
  if (ancestorEvent.getAncestor().equals(mainPanel))
  {
    PDFDebugger debugger = (PDFDebugger) SwingUtilities.getRoot(mainPanel);
    debugger.getFindMenu().setEnabled(true);
    searcher.addMenuListeners(debugger);
  }
}

代码示例来源:origin: apache/pdfbox

@Override
public void ancestorRemoved(AncestorEvent ancestorEvent)
{
  if (ancestorEvent.getAncestor().equals(mainPanel))
  {
    PDFDebugger debugger = (PDFDebugger) SwingUtilities.getRoot(mainPanel);
    debugger.getFindMenu().setEnabled(false);
    searcher.removeMenuListeners(debugger);
  }
}

代码示例来源:origin: apache/pdfbox

recentFilesMenu.add(recentFileMenuItem);
recentFilesMenu.setEnabled(true);

代码示例来源:origin: apache/pdfbox

recentFilesMenu.setEnabled(false);
addRecentFileItems();
fileMenu.add(recentFilesMenu);

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Overridden to toggle the enabled state of various
 * RSyntaxTextArea-specific menu items.
 *
 * If you set the popup menu via {@link #setPopupMenu(JPopupMenu)}, you
 * will want to override this method, especially if you removed any of the
 * menu items in the default popup menu.
 *
 * @param popupMenu The popup menu.  This will never be <code>null</code>.
 * @see #createPopupMenu()
 * @see #setPopupMenu(JPopupMenu)
 */
@Override
protected void configurePopupMenu(JPopupMenu popupMenu) {
  super.configurePopupMenu(popupMenu);
  // They may have overridden createPopupMenu()...
  if (popupMenu!=null && popupMenu.getComponentCount()>0 &&
      foldingMenu!=null) {
    foldingMenu.setEnabled(foldManager.
          isCodeFoldingSupportedAndEnabled());
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

multi.setEnabled(true);

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    JMenuItem menuItemStrategy = MediatorGui.managerDatabase().getMenuStrategy().getItem(i);
    if (menuItemStrategy.getText().equals(StrategyInjection.ERROR.toString())) {
      JMenu menuError = (JMenu) menuItemStrategy;
      menuError.setEnabled(true);
      
      // Fix #46578: ArrayIndexOutOfBoundsException on getItem()
      if (0 <= this.indexMethodError && this.indexMethodError < menuError.getItemCount()) {
        menuError.getItem(this.indexMethodError).setEnabled(true);
      }
      break;
    }
  }
}

代码示例来源:origin: apache/pdfbox

public void removeMenuListeners(PDFDebugger frame)
  {
    frame.getFindMenu().setEnabled(false);
    frame.getFindMenuItem().removeActionListener(findAction);
    frame.getFindNextMenuItem().removeActionListener(nextAction);
    frame.getFindPreviousMenuItem().removeActionListener(previousAction);
  }
}

代码示例来源:origin: Audiveris/audiveris

/**
   * Enable or disable the menu.
   *
   * @param bool true for enable
   */
  public void setEnabled (boolean bool)
  {
    menu.setEnabled(bool);
  }
}

代码示例来源:origin: pentaho/mondrian

windowMenu.setEnabled(true);

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

private void adjustSessionMenu()
{
 if(null == _dockTabDesktopPane.getSelectedWidget())
 {
   _mnuSession.setEnabled(false);
 }
 else
 {
   _mnuSession.setEnabled(true);
 }
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

public void setProjectFileLoaded(String file) {
  if (fileLoadRecentFiles != null && file != null) {
    LoadRecentProject.updateRecentFileMenuItems(fileLoadRecentFiles, file);
    recentFilesOpen.setEnabled(true);
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-bugtracking

@Override
public void setEnabled(boolean newValue) {
  super.setEnabled(newValue);
  menu.setEnabled(newValue);
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

public static void setEnabled(JMenu menu) {
  if (menu.getSubElements().length == 0) {
    menu.setEnabled(false);
  }
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

public void addSubMenu(JMenu _m, boolean _enabled)
{
 _m.setEnabled(_enabled);
 _m.addActionListener(this);
 this.add(_m);
}

代码示例来源:origin: org.boofcv/demonstrations

protected void setMenuBarEnabled( boolean enabled ) {
  menuBar.setEnabled(enabled);
  for (int i = 0; i < menuBar.getMenuCount(); i++) {
    menuBar.getMenu(i).setEnabled(enabled);
  }
}

相关文章