Java 类javax.swing.plaf.basic.BasicLookAndFeel 实例源码

项目:intellij-ce-playground    文件:DarculaLaf.java   
private static void applySystemFonts(UIDefaults defaults) {
  try {
    String fqn = UIManager.getSystemLookAndFeelClassName();
    Object systemLookAndFeel = Class.forName(fqn).newInstance();
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("getDefaults");
    superMethod.setAccessible(true);
    final UIDefaults systemDefaults = (UIDefaults)superMethod.invoke(systemLookAndFeel);
    for (Map.Entry<Object, Object> entry : systemDefaults.entrySet()) {
      if (entry.getValue() instanceof Font) {
        defaults.put(entry.getKey(), entry.getValue());
      }
    }
  } catch (Exception e) {
    log(e);
  }
}
项目:jdk8u-jdk    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:openjdk-jdk10    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:openjdk9    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:jdk8u_jdk    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:lookaside_java-1.8.0-openjdk    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:intellij-ce-playground    文件:BegMenuItemUI.java   
/** Copied from BasicMenuItemUI */
private void doClick(MenuSelectionManager msm,MouseEvent e) {
  // Auditory cue
  if(!isInternalFrameSystemMenu()){
    @NonNls ActionMap map=menuItem.getActionMap();
    if(map!=null){
      Action audioAction=map.get(getPropertyPrefix()+".commandSound");
      if(audioAction!=null){
        // pass off firing the Action to a utility method
        BasicLookAndFeel lf=(BasicLookAndFeel)UIManager.getLookAndFeel();
        // It's a hack. The method BasicLookAndFeel.playSound has protected access, so
        // it's imposible to mormally invoke it.
        try {
          Method playSoundMethod=BasicLookAndFeel.class.getDeclaredMethod(PLAY_SOUND_METHOD,new Class[]{Action.class});
          playSoundMethod.setAccessible(true);
          playSoundMethod.invoke(lf,new Object[]{audioAction});
        } catch(Exception ignored) {}
      }
    }
  }
  // Visual feedback
  if(msm==null){
    msm=MenuSelectionManager.defaultManager();
  }
  msm.clearSelectedPath();
  ((ActionMenuItem)menuItem).fireActionPerformed(
    new ActionEvent(
      menuItem,
      ActionEvent.ACTION_PERFORMED,
      null,
      e.getWhen(),
      e.getModifiers()
    )
  );
}
项目:intellij-ce-playground    文件:DarculaLaf.java   
public DarculaLaf() {
  try {
    if (SystemInfo.isWindows || SystemInfo.isLinux) {
      base = new IdeaLaf();
    } else {
      final String name = UIManager.getSystemLookAndFeelClassName();
      base = (BasicLookAndFeel)Class.forName(name).newInstance();
    }
  }
  catch (Exception e) {
    log(e);
  }
}
项目:intellij-ce-playground    文件:DarculaLaf.java   
private void callInit(String method, UIDefaults defaults) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod(method, UIDefaults.class);
    superMethod.setAccessible(true);
    superMethod.invoke(base, defaults);
  }
  catch (Exception e) {
    log(e);
  }
}
项目:intellij-ce-playground    文件:DarculaLaf.java   
private void call(String method) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod(method);
    superMethod.setAccessible(true);
    superMethod.invoke(base);
  }
  catch (Exception ignore) {
    log(ignore);
  }
}
项目:intellij-ce-playground    文件:DarculaLaf.java   
@Override
protected void loadSystemColors(UIDefaults defaults, String[] systemColors, boolean useNative) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("loadSystemColors",
                                                                 UIDefaults.class,
                                                                 String[].class,
                                                                 boolean.class);
    superMethod.setAccessible(true);
    superMethod.invoke(base, defaults, systemColors, useNative);
  }
  catch (Exception ignore) {
    log(ignore);
  }
}
项目:infobip-open-jdk-8    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:jdk8u-dev-jdk    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:jdk7-jdk    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:openjdk-source-code-learn    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:OLD-OpenJDK8    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:cn1    文件:UIDefaultsTest.java   
private void setBasicLF() {
    try {
        UIManager.setLookAndFeel(new BasicLookAndFeel() {
            private static final long serialVersionUID = 1L;

            @Override
            public boolean isNativeLookAndFeel() {
                return true;
            }

            @Override
            public boolean isSupportedLookAndFeel() {
                return true;
            }

            @Override
            public String getDescription() {
                return null;
            }

            @Override
            public String getID() {
                return null;
            }

            @Override
            public String getName() {
                return null;
            }
        });
    } catch (UnsupportedLookAndFeelException e) {
        e.printStackTrace();
    }
}
项目:JAVA_UNIT    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:tools-idea    文件:BegMenuItemUI.java   
/** Copied from BasicMenuItemUI */
private void doClick(MenuSelectionManager msm,MouseEvent e) {
  // Auditory cue
  if(!isInternalFrameSystemMenu()){
    @NonNls ActionMap map=menuItem.getActionMap();
    if(map!=null){
      Action audioAction=map.get(getPropertyPrefix()+".commandSound");
      if(audioAction!=null){
        // pass off firing the Action to a utility method
        BasicLookAndFeel lf=(BasicLookAndFeel)UIManager.getLookAndFeel();
        // It's a hack. The method BasicLookAndFeel.playSound has protected access, so
        // it's imposible to mormally invoke it.
        try {
          Method playSoundMethod=BasicLookAndFeel.class.getDeclaredMethod(PLAY_SOUND_METHOD,new Class[]{Action.class});
          playSoundMethod.setAccessible(true);
          playSoundMethod.invoke(lf,new Object[]{audioAction});
        } catch(Exception ignored) {}
      }
    }
  }
  // Visual feedback
  if(msm==null){
    msm=MenuSelectionManager.defaultManager();
  }
  msm.clearSelectedPath();
  ((ActionMenuItem)menuItem).fireActionPerformed(
    new ActionEvent(
      menuItem,
      ActionEvent.ACTION_PERFORMED,
      null,
      e.getWhen(),
      e.getModifiers()
    )
  );
}
项目:tools-idea    文件:DarculaLaf.java   
public DarculaLaf() {
  try {
    if (SystemInfo.isWindows || SystemInfo.isLinux) {
      base = new IdeaLaf();
    } else {
      final String name = UIManager.getSystemLookAndFeelClassName();
      base = (BasicLookAndFeel)Class.forName(name).newInstance();
    }
  }
  catch (Exception e) {
    log(e);
  }
}
项目:tools-idea    文件:DarculaLaf.java   
private void callInit(String method, UIDefaults defaults) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod(method, UIDefaults.class);
    superMethod.setAccessible(true);
    superMethod.invoke(base, defaults);
  }
  catch (Exception e) {
    log(e);
  }
}
项目:tools-idea    文件:DarculaLaf.java   
@Override
public UIDefaults getDefaults() {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("getDefaults");
    superMethod.setAccessible(true);
    final UIDefaults metalDefaults = (UIDefaults)superMethod.invoke(new MetalLookAndFeel());
    final UIDefaults defaults = (UIDefaults)superMethod.invoke(base);
    if (SystemInfo.isLinux) {
      Font font = findFont("DejaVu Sans");
      if (font != null) {
        for (Object key : defaults.keySet()) {
          if (key instanceof String && ((String)key).endsWith(".font")) {
            defaults.put(key, new FontUIResource(font.deriveFont(13f)));
          }
        }
      }
    }

    LafManagerImpl.initInputMapDefaults(defaults);
    initIdeaDefaults(defaults);
    patchStyledEditorKit();
    patchComboBox(metalDefaults, defaults);
    defaults.remove("Spinner.arrowButtonBorder");
    defaults.put("Spinner.arrowButtonSize", new Dimension(16, 5));
    MetalLookAndFeel.setCurrentTheme(new DarculaMetalTheme());
    if (SystemInfo.isWindows) {
      //JFrame.setDefaultLookAndFeelDecorated(true);
    }

    return defaults;
  }
  catch (Exception e) {
    log(e);
  }
  return super.getDefaults();
}
项目:tools-idea    文件:DarculaLaf.java   
private void call(String method) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod(method);
    superMethod.setAccessible(true);
    superMethod.invoke(base);
  }
  catch (Exception ignore) {
    log(ignore);
  }
}
项目:tools-idea    文件:DarculaLaf.java   
@Override
protected void loadSystemColors(UIDefaults defaults, String[] systemColors, boolean useNative) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("loadSystemColors",
                                                                 UIDefaults.class,
                                                                 String[].class,
                                                                 boolean.class);
    superMethod.setAccessible(true);
    superMethod.invoke(base, defaults, systemColors, useNative);
  }
  catch (Exception ignore) {
    log(ignore);
  }
}
项目:openjdk-jdk7u-jdk    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:freeVM    文件:UIDefaultsTest.java   
private void setBasicLF() {
    try {
        UIManager.setLookAndFeel(new BasicLookAndFeel() {
            private static final long serialVersionUID = 1L;

            @Override
            public boolean isNativeLookAndFeel() {
                return true;
            }

            @Override
            public boolean isSupportedLookAndFeel() {
                return true;
            }

            @Override
            public String getDescription() {
                return null;
            }

            @Override
            public String getID() {
                return null;
            }

            @Override
            public String getName() {
                return null;
            }
        });
    } catch (UnsupportedLookAndFeelException e) {
        e.printStackTrace();
    }
}
项目:freeVM    文件:UIDefaultsTest.java   
private void setBasicLF() {
    try {
        UIManager.setLookAndFeel(new BasicLookAndFeel() {
            private static final long serialVersionUID = 1L;

            @Override
            public boolean isNativeLookAndFeel() {
                return true;
            }

            @Override
            public boolean isSupportedLookAndFeel() {
                return true;
            }

            @Override
            public String getDescription() {
                return null;
            }

            @Override
            public String getID() {
                return null;
            }

            @Override
            public String getName() {
                return null;
            }
        });
    } catch (UnsupportedLookAndFeelException e) {
        e.printStackTrace();
    }
}
项目:Darcula    文件:DarculaLaf.java   
public DarculaLaf() {
  try {
    if (SystemInfo.isWindows || SystemInfo.isLinux) {
      base = new MetalLookAndFeel();
      MetalLookAndFeel.setCurrentTheme(new DarculaMetalTheme());
    } else {
      final String name = UIManager.getSystemLookAndFeelClassName();
      base = (BasicLookAndFeel)Class.forName(name).newInstance();
    }
  }
  catch (Exception ignore) {
    log(ignore);
  }
}
项目:Darcula    文件:DarculaLaf.java   
private void callInit(String method, UIDefaults defaults) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod(method, UIDefaults.class);
    superMethod.setAccessible(true);
    superMethod.invoke(base, defaults);
  }
  catch (Exception ignore) {
    log(ignore);
  }
}
项目:Darcula    文件:DarculaLaf.java   
@Override
public UIDefaults getDefaults() {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("getDefaults");
    superMethod.setAccessible(true);
    final UIDefaults metalDefaults =
        (UIDefaults)superMethod.invoke(new MetalLookAndFeel());
    final UIDefaults defaults = (UIDefaults)superMethod.invoke(base);
    initInputMapDefaults(defaults);
    initIdeaDefaults(defaults);
    patchStyledEditorKit();
    patchComboBox(metalDefaults, defaults);
    defaults.remove("Spinner.arrowButtonBorder");
    defaults.put("Spinner.arrowButtonSize", new Dimension(16, 5));
    defaults.put("Tree.collapsedIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/treeNodeCollapsed.png")));
    defaults.put("Tree.expandedIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/treeNodeExpanded.png")));
    defaults.put("Menu.arrowIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/menuItemArrowIcon.png")));
    defaults.put("CheckBoxMenuItem.checkIcon", EmptyIcon.create(16));
    defaults.put("RadioButtonMenuItem.checkIcon", EmptyIcon.create(16));
    defaults.put("InternalFrame.icon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/internalFrame.png")));
    defaults.put("OptionPane.informationIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/option_pane_info.png")));
    defaults.put("OptionPane.questionIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/option_pane_question.png")));
    defaults.put("OptionPane.warningIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/option_pane_warning.png")));
    defaults.put("OptionPane.errorIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/option_pane_error.png")));
    if (SystemInfo.isMac && !"true".equalsIgnoreCase(System.getProperty("apple.laf.useScreenMenuBar", "false"))) {
      defaults.put("MenuBarUI", "com.bulenkov.darcula.ui.DarculaMenuBarUI");
      defaults.put("MenuUI", "javax.swing.plaf.basic.BasicMenuUI");
    }
    return defaults;
  }
  catch (Exception ignore) {
    log(ignore);
  }
  return super.getDefaults();
}
项目:Darcula    文件:DarculaLaf.java   
private void call(String method) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod(method);
    superMethod.setAccessible(true);
    superMethod.invoke(base);
  }
  catch (Exception ignore) {
    log(ignore);
  }
}
项目:Darcula    文件:DarculaLaf.java   
@Override
protected void loadSystemColors(UIDefaults defaults, String[] systemColors, boolean useNative) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("loadSystemColors",
        UIDefaults.class,
        String[].class,
        boolean.class);
    superMethod.setAccessible(true);
    superMethod.invoke(base, defaults, systemColors, useNative);
  }
  catch (Exception ignore) {
    log(ignore);
  }
}
项目:openjdk-icedtea7    文件:Test6984643.java   
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new BasicLookAndFeel() {
        public String getName() {
            return "A name";
        }

        public String getID() {
            return "An id";
        }

        public String getDescription() {
            return "A description";
        }

        public boolean isNativeLookAndFeel() {
            return false;
        }

        public boolean isSupportedLookAndFeel() {
            return true;
        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new JFileChooser();
        }
    });
}
项目:consulo    文件:ModernDarkLaf.java   
public ModernDarkLaf() {
  try {
    if (SystemInfo.isWindows || SystemInfo.isLinux) {
      base = new IntelliJMetalLookAndFeel();
    }
    else {
      final String name = UIManager.getSystemLookAndFeelClassName();
      base = (BasicLookAndFeel)Class.forName(name).newInstance();
    }
  }
  catch (Exception e) {
    log(e);
  }
}
项目:consulo    文件:ModernDarkLaf.java   
private void callInit(String method, UIDefaults defaults) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod(method, UIDefaults.class);
    superMethod.setAccessible(true);
    superMethod.invoke(base, defaults);
  }
  catch (Exception e) {
    log(e);
  }
}
项目:consulo    文件:ModernDarkLaf.java   
@Override
public UIDefaults getDefaults() {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("getDefaults");
    superMethod.setAccessible(true);
    final UIDefaults metalDefaults = (UIDefaults)superMethod.invoke(new MetalLookAndFeel());
    final UIDefaults defaults = (UIDefaults)superMethod.invoke(base);
    if (SystemInfo.isLinux && !Registry.is("darcula.use.native.fonts.on.linux")) {
      Font font = findFont("DejaVu Sans");
      if (font != null) {
        for (Object key : defaults.keySet()) {
          if (key instanceof String && ((String)key).endsWith(".font")) {
            defaults.put(key, new FontUIResource(font.deriveFont(13f)));
          }
        }
      }
    }

    LafManagerImpl.initInputMapDefaults(defaults);
    initIdeaDefaults(defaults);
    patchStyledEditorKit(defaults);
    patchComboBox(metalDefaults, defaults);
    defaults.remove("Spinner.arrowButtonBorder");
    defaults.put("Spinner.arrowButtonSize", new Dimension(16, 5));
    MetalLookAndFeel.setCurrentTheme(createMetalTheme());
    if (SystemInfo.isWindows) {
      //JFrame.setDefaultLookAndFeelDecorated(true);
    }
    defaults.put("EditorPane.font", defaults.getFont("TextField.font"));
    return defaults;
  }
  catch (Exception e) {
    log(e);
  }
  return super.getDefaults();
}
项目:consulo    文件:ModernDarkLaf.java   
private void call(String method) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod(method);
    superMethod.setAccessible(true);
    superMethod.invoke(base);
  }
  catch (Exception ignore) {
    log(ignore);
  }
}
项目:consulo    文件:ModernDarkLaf.java   
@Override
protected void loadSystemColors(UIDefaults defaults, String[] systemColors, boolean useNative) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("loadSystemColors", UIDefaults.class, String[].class, boolean.class);
    superMethod.setAccessible(true);
    superMethod.invoke(base, defaults, systemColors, useNative);
  }
  catch (Exception ignore) {
    log(ignore);
  }
}
项目:consulo    文件:BegMenuItemUI.java   
/**
 * Copied from BasicMenuItemUI
 */
private void doClick(MenuSelectionManager msm, MouseEvent e) {
  // Auditory cue
  if (!isInternalFrameSystemMenu()) {
    @NonNls ActionMap map = menuItem.getActionMap();
    if (map != null) {
      Action audioAction = map.get(getPropertyPrefix() + ".commandSound");
      if (audioAction != null) {
        // pass off firing the Action to a utility method
        BasicLookAndFeel lf = (BasicLookAndFeel)UIManager.getLookAndFeel();
        // It's a hack. The method BasicLookAndFeel.playSound has protected access, so
        // it's imposible to mormally invoke it.
        try {
          Method playSoundMethod = BasicLookAndFeel.class.getDeclaredMethod(PLAY_SOUND_METHOD, new Class[]{Action.class});
          playSoundMethod.setAccessible(true);
          playSoundMethod.invoke(lf, new Object[]{audioAction});
        }
        catch (Exception ignored) {
        }
      }
    }
  }
  // Visual feedback
  if (msm == null) {
    msm = MenuSelectionManager.defaultManager();
  }
  msm.clearSelectedPath();
  menuItem.doClick(0);
}
项目:consulo    文件:DarculaLaf.java   
public DarculaLaf() {
  try {
    if (SystemInfo.isWindows || SystemInfo.isLinux) {
      base = new IntelliJMetalLookAndFeel();
    } else {
      final String name = UIManager.getSystemLookAndFeelClassName();
      base = (BasicLookAndFeel)Class.forName(name).newInstance();
    }
  }
  catch (Exception e) {
    log(e);
  }
}