javax.swing.JMenuBar.revalidate()方法的使用及代码示例

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

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

JMenuBar.revalidate介绍

暂无

代码示例

代码示例来源:origin: org.zaproxy/zap

private void addMenuHelper(JMenuBar menuBar, List<JMenuItem> items, int existingCount) {
  for (JMenuItem item : items) {
    if (item != null) {
      menuBar.add(item, menuBar.getMenuCount() - existingCount);
    }
  }
  menuBar.revalidate();
}

代码示例来源:origin: org.zaproxy/zap

private void removeMenuHelper(JMenuBar menuBar, List<JMenuItem> items) {
  for (JMenuItem item : items) {
    if (item != null) {
      menuBar.remove(item);
    }
  }
  menuBar.revalidate();
}

代码示例来源:origin: net.java.openjdk.cacio/cacio-shared

public void addMenu(Menu m) {
  JMenuBar jmb = getSwingMenu();
  // If we have a help menu, add new menus add the last - 1 position,
  // otherwise we append at the end.
  if (helpMenu != null) {
    jmb.add(getSwingMenu(m), jmb.getComponentCount() - 1);
  } else {
    jmb.add(getSwingMenu(m));
  }
  // Force re-layout.
  jmb.revalidate();
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = CLEAR_JSDOC)
@Override
public void clear() {
  super.removeAll();
  super.revalidate();
  super.repaint();
}

代码示例来源:origin: net.java.openjdk.cacio/cacio-shared

public void addHelpMenu(Menu m) {
  // Remove old help menu, if there is one.
  JMenuBar jmb = getSwingMenu();
  if (helpMenu != null) {
    jmb.remove(getSwingMenu(helpMenu));
  }
  // Add new help menu.
  helpMenu = m;
  jmb.add(getSwingMenu(m));
  // Force re-layout.
  jmb.revalidate();
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = REMOVE_JSDOC, params = {"component"})
@Override
public void remove(JComponent aComp) {
  super.remove(aComp);
  super.revalidate();
  super.repaint();
}

代码示例来源:origin: jawi/ols

@Override
 public void run()
 {
  final JMenuBar menuBar = getMainMenuBar();
  if ( menuBar != null )
  {
   final JMenu menu = ( JMenu )aProvider.getComponent();
   menuBar.add( menu );
   aProvider.addedToContainer();
   menuBar.revalidate();
   menuBar.repaint();
  }
 }
} );

代码示例来源:origin: girtel/Net2Plan

/**
 * Refresh main menu with currently loaded GUI plugins.
 *
 * @since 0.3.1
 */
public static void refreshMenu() {
  instance.usedKeyStrokes.clear();
  while (instance.menu.getComponentCount() > 2) instance.menu.remove(1);
  for (Class<? extends Plugin> plugin : PluginSystem.getPlugins(IGUIModule.class)) {
    try {
      IGUIModule pluginInstance = ((Class<? extends IGUIModule>) plugin).newInstance();
      String menuName = pluginInstance.getMenu();
      JMenuItem item = getCurrentMenu(instance.menu, null, menuName);
      item.addActionListener(instance);
      KeyStroke keystroke = pluginInstance.getKeyStroke();
      if (keystroke != null && !instance.usedKeyStrokes.contains(keystroke)) {
        item.setAccelerator(keystroke);
        instance.usedKeyStrokes.add(keystroke);
      }
      instance.itemObject.put(item, plugin);
    } catch (NoClassDefFoundError e) {
      throw new Net2PlanException("Class " + e.getMessage() + " cannot be found. A dependence for " + plugin.getSimpleName() + " is missing?");
    } catch (Throwable e) {
      throw new RuntimeException(e);
    }
  }
  instance.menu.revalidate();
}

代码示例来源:origin: net.sf.sfac/sfac-core

menuBar.revalidate();
menuBar.repaint();

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

jcomp.revalidate();

代码示例来源:origin: jawi/ols

@Override
 public void run()
 {
  final JMenuBar menuBar = getMainMenuBar();
  if ( menuBar != null )
  {
   aProvider.removedFromContainer();
   menuBar.remove( aProvider.getComponent() );
   menuBar.revalidate();
   menuBar.repaint();
  }
 }
} );

代码示例来源:origin: elki-project/elki

menubar.add(item);
menubar.revalidate();
menubar.repaint();

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-batik-visualization

menubar.add(item);
menubar.revalidate();
menubar.repaint();

相关文章