javax.swing.JPopupMenu.setDefaultLightWeightPopupEnabled()方法的使用及代码示例

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

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

JPopupMenu.setDefaultLightWeightPopupEnabled介绍

暂无

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void run(){
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    createFrame();
    currentPanel.add(canvas, BorderLayout.CENTER);
    frame.pack();
    startApp();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
});

代码示例来源:origin: runelite/runelite

/**
 * Sets some sensible defaults for swing.
 * IMPORTANT! Needs to be called before main frame creation
 */
public static void setupDefaults()
{
  // Force heavy-weight popups/tooltips.
  // Prevents them from being obscured by the game applet.
  ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
  ToolTipManager.sharedInstance().setInitialDelay(300);
  JPopupMenu.setDefaultLightWeightPopupEnabled(false);
  UIManager.put("Button.foreground", Color.WHITE);
  UIManager.put("MenuItem.foreground", Color.WHITE);
  UIManager.put("Panel.background", ColorScheme.DARK_GRAY_COLOR);
  UIManager.put("ScrollBarUI", CustomScrollBarUI.class.getName());
  UIManager.put("TextField.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT);
  UIManager.put("TextField.selectionForeground", Color.WHITE);
  UIManager.put("FormattedTextField.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT);
  UIManager.put("FormattedTextField.selectionForeground", Color.WHITE);
  UIManager.put("TextArea.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT);
  UIManager.put("TextArea.selectionForeground", Color.WHITE);
  // Do not render shadows under popups/tooltips.
  // Fixes black boxes under popups that are above the game applet.
  System.setProperty("jgoodies.popupDropShadowEnabled", "false");
  // Do not fill in background on repaint. Reduces flickering when
  // the applet is resized.
  System.setProperty("sun.awt.noerasebackground", "true");
}

代码示例来源:origin: MovingBlocks/Terasology

public void run() {
  JPopupMenu.setDefaultLightWeightPopupEnabled(false);

代码示例来源:origin: MrCrayfish/ModelCreator

private void setupMenuBar()
{
  JPopupMenu.setDefaultLightWeightPopupEnabled(false);
  setJMenuBar(new com.mrcrayfish.modelcreator.component.Menu(this));
}

代码示例来源:origin: lycying/c2d-engine

/**
 * Launch the application.
 *
 * @throws Exception
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws ClassNotFoundException
 */
public static void main(String[] args) throws Exception {
  try {
    javax.swing.UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
  } catch (Exception ex) {
  }
  JPopupMenu.setDefaultLightWeightPopupEnabled(false);
  ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
  EventQueue.invokeLater(new Runnable() {
    public void run() {
      try {
        Main window = new Main();
        window.frmCdboxdSceneEditor.setVisible(true);
        Canvas canvas = new Canvas();
        EditorAdapter.setupCanvas(canvas);
        Main.INSTANCE.canvasPanel.add(canvas);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  });
}

代码示例来源:origin: com.harium.propan/propan-jogl

/**
 * Checks the component and all children to ensure that everything is pure
 * Swing. We can only draw lightweights.
 * 
 * 
 * We'll also set PopupMenus to heavyweight and fix JViewport blitting.
 */
protected void verifyHierarchy(Component comp) {
 JPopupMenu.setDefaultLightWeightPopupEnabled(false);
 if (!(comp instanceof JComponent)) {
  Logger.getLogger(GLG2DCanvas.class.getName()).warning("Drawable component and children should be pure Swing: " +
    comp + " does not inherit JComponent");
 }
 if (comp instanceof JViewport) {
  ((JViewport) comp).setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
 }
 if (comp instanceof Container) {
  Container cont = (Container) comp;
  for (int i = 0; i < cont.getComponentCount(); i++) {
   verifyHierarchy(cont.getComponent(i));
  }
 }
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

public MenuMgr() {
    super();
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    menu = new JMenu("File");
    menu.add(new CreateWindowAction("Create New VTK Window"));
    menu.add(new KillAction("Exit"));
    add(menu);
    addMenuBar(this);
  }
}

代码示例来源:origin: net.sf.jung/jung-samples

JPopupMenu.setDefaultLightWeightPopupEnabled(false);
JMenuBar menuBar = new JMenuBar();
menuBar.add(menu);

代码示例来源:origin: jrtom/jung

JPopupMenu.setDefaultLightWeightPopupEnabled(false);
JMenuBar menuBar = new JMenuBar();
menuBar.add(menu);

代码示例来源:origin: gurkenlabs/litiengine

public static void initSwingComponentStyle() {
 try {
  JPopupMenu.setDefaultLightWeightPopupEnabled(false);
  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  UIManager.getDefaults().put("SplitPane.border", BorderFactory.createEmptyBorder());
  setDefaultSwingFont(new FontUIResource(Resources.fonts().get("OpenSans.ttf", Font.PLAIN, 11)));
 } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
  log.log(Level.SEVERE, e.getLocalizedMessage(), e);
 }
}

代码示例来源:origin: brandonborkholder/glg2d

/**
 * Checks the component and all children to ensure that everything is pure
 * Swing. We can only draw lightweights.
 *
 *
 * We'll also set PopupMenus to heavyweight and fix JViewport blitting.
 */
protected void verifyHierarchy(Component comp) {
 JPopupMenu.setDefaultLightWeightPopupEnabled(false);
 if (comp instanceof JComponent) {
  ((JComponent) comp).setDoubleBuffered(false);
 }
 if (!(comp instanceof JComponent)) {
  Logger.getLogger(GLG2DCanvas.class.getName()).warning("Drawable component and children should be pure Swing: " +
    comp + " does not inherit JComponent");
 }
 if (comp instanceof JViewport) {
  ((JViewport) comp).setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
 }
 if (comp instanceof Container) {
  Container cont = (Container) comp;
  for (int i = 0; i < cont.getComponentCount(); i++) {
   verifyHierarchy(cont.getComponent(i));
  }
 }
}

代码示例来源:origin: matsim-org/matsim

JPopupMenu.setDefaultLightWeightPopupEnabled(false);
compositePanel = new JPanel();
compositePanel.setBackground(Color.white);

代码示例来源:origin: org.gephi/visualization

public GraphCanvas() {
    super();
    glCanvas = new GLCanvas(getCaps());

    super.initDrawable(glCanvas);
//        glCanvas.setMinimumSize(new Dimension(0, 0));   //Fix Canvas resize Issue

    //Basic init
    graphComponent = (Component) glCanvas;
//        graphComponent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    //False lets the components appear on top of the canvas
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
  }

代码示例来源:origin: sing-group/GC4S

private void initComponent() {
  JPopupMenu.setDefaultLightWeightPopupEnabled(false);
  ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);

代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking

/** Facade method used to allow mixing of lightweight and heavyweight components in the 
 * desktop.
 * <p>
 *  This method is a shortcut for : 
 * <pre>
 *        ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
 *        JPopupMenu.setDefaultLightWeightPopupEnabled(false);        
 *        setLightweigthComponentEnabled(false);
 *        getAutoHidePolicy().setExpansionDuration(0);
 * </pre>
 */
public static void initHeavyWeightUsage() {
  // for now, there are only two methods used.
  ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
  JPopupMenu.setDefaultLightWeightPopupEnabled(false);
  setLightweigthComponentEnabled(false);
  getAutoHidePolicy().setExpansionDuration(0);
}

代码示例来源:origin: it.tidalwave.solidblue/it-tidalwave-netbeans-lookandfeel

JPopupMenu.setDefaultLightWeightPopupEnabled(false);
installNimrod();

代码示例来源:origin: org.gephi/visualization

public NewtGraphCanvas() {
    super();
    glWindow = GLWindow.create(getCaps());
//        glWindow.setSurfaceScale(new float[]{ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE});
    glCanvas = new NewtCanvasAWT(glWindow);

    super.initDrawable(glWindow);
//        glCanvas.setFocusable(true);
//        glCanvas.setIgnoreRepaint(true);
//        glCanvas.setMinimumSize(new Dimension(0, 0));   //Fix Canvas resize Issue

//        glCanvas.setMinimumSize(new Dimension(0, 0));   //Fix Canvas resize Issue
    //Basic init
    graphComponent = (Component) glCanvas;
    window = glWindow;
//        graphComponent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    //False lets the components appear on top of the canvas
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
  }

代码示例来源:origin: dhale/jtk

SelectDragMode sdm = new SelectDragMode(mm);
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);

代码示例来源:origin: sc.fiji/3D_Viewer

JPopupMenu.setDefaultLightWeightPopupEnabled(false);
plDialog = new PointListDialog(this.win);
plDialog.addWindowListener(new WindowAdapter() {

代码示例来源:origin: robo-code/robocode

public MenuBar(ISettingsManager properties,
    IWindowManagerExt windowManager,
    IBattleManager battleManager,
    IRecordManager recordManager,
    ICpuManager cpuManager) {
  this.properties = properties;
  this.windowManager = windowManager;
  this.battleManager = battleManager;
  this.recordManager = recordManager;
  this.cpuManager = cpuManager;
  // FNL: Make sure that menus are heavy-weight components so that the menus are not painted
  // behind the BattleView which is a heavy-weight component. This must be done before
  // adding any menu to the menubar.
  JPopupMenu.setDefaultLightWeightPopupEnabled(false);
  add(getBattleMenu());
  add(getRobotMenu());
  add(getOptionsMenu());
  add(getHelpMenu());
}

相关文章

JPopupMenu类方法