当前位置: 首页>>代码示例>>Java>>正文


Java BasicLookAndFeel类代码示例

本文整理汇总了Java中javax.swing.plaf.basic.BasicLookAndFeel的典型用法代码示例。如果您正苦于以下问题:Java BasicLookAndFeel类的具体用法?Java BasicLookAndFeel怎么用?Java BasicLookAndFeel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicLookAndFeel类属于javax.swing.plaf.basic包,在下文中一共展示了BasicLookAndFeel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applySystemFonts

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DarculaLaf.java

示例2: main

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
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();
        }
    });
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:30,代码来源:Test6984643.java

示例3: doClick

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
/** 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()
    )
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:BegMenuItemUI.java

示例4: DarculaLaf

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DarculaLaf.java

示例5: callInit

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:DarculaLaf.java

示例6: call

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
private void call(String method) {
  try {
    final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod(method);
    superMethod.setAccessible(true);
    superMethod.invoke(base);
  }
  catch (Exception ignore) {
    log(ignore);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:DarculaLaf.java

示例7: loadSystemColors

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:DarculaLaf.java

示例8: setBasicLF

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
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();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:35,代码来源:UIDefaultsTest.java

示例9: getDefaults

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
@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();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:37,代码来源:DarculaLaf.java

示例10: DarculaLaf

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
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);
  }
}
 
开发者ID:bulenkov,项目名称:Darcula,代码行数:15,代码来源:DarculaLaf.java

示例11: callInit

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
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);
  }
}
 
开发者ID:bulenkov,项目名称:Darcula,代码行数:11,代码来源:DarculaLaf.java

示例12: getDefaults

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
@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();
}
 
开发者ID:bulenkov,项目名称:Darcula,代码行数:36,代码来源:DarculaLaf.java

示例13: loadSystemColors

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:bulenkov,项目名称:Darcula,代码行数:15,代码来源:DarculaLaf.java

示例14: ModernDarkLaf

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
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);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:ModernDarkLaf.java

示例15: getDefaults

import javax.swing.plaf.basic.BasicLookAndFeel; //导入依赖的package包/类
@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();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:37,代码来源:ModernDarkLaf.java


注:本文中的javax.swing.plaf.basic.BasicLookAndFeel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。