org.jdesktop.swingx.util.OS类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(351)

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

OS介绍

[英]Provides methods related to the runtime environment.
[中]提供与运行时环境相关的方法。

代码示例

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * Gets the addon best suited for the operating system where the
 * virtual machine is running.
 *
 * @return the addon matching the native operating system platform.
 */
public static String getSystemAddonClassName() {
 String addon = WindowsClassicLookAndFeelAddons.class.getName();
 if (OS.isMacOSX()) {
  addon = MacOSXLookAndFeelAddons.class.getName();
 } else if (OS.isWindows()) {
  // see whether of not visual styles are used
  if (OS.isUsingWindowsVisualStyles()) {
   addon = WindowsLookAndFeelAddons.class.getName();
  } else {
   addon = WindowsClassicLookAndFeelAddons.class.getName();
  }
 } else if (OS.isLinux()) {
  addon = LinuxLookAndFeelAddons.class.getName();
 }
 return addon;
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-plaf

/**
 * {@inheritDoc}
 */
@Override
protected boolean isSystemAddon() {
  return OS.isWindows() && OS.isUsingWindowsVisualStyles();
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

@Override
  protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
    super.addWindowsDefaults(addon, defaults);
    if (OS.isUsingWindowsVisualStyles()) {
      defaults.add(JXStatusBar.uiClassID,
          "org.jdesktop.swingx.plaf.windows.WindowsStatusBarUI");
      
      String xpStyle = OS.getWindowsVisualStyle();
      
      if (WindowsLookAndFeelAddons.SILVER_VISUAL_STYLE.equalsIgnoreCase(xpStyle)
          || WindowsLookAndFeelAddons.VISTA_VISUAL_STYLE.equalsIgnoreCase(xpStyle)) {
        defaults.add("StatusBar.leftImage", "resources/silver-statusbar-left.png");
        defaults.add("StatusBar.middleImage", "resources/silver-statusbar-middle.png");
        defaults.add("StatusBar.rightImage", "resources/silver-statusbar-right.png");
      } else {
        defaults.add("StatusBar.leftImage", "resources/statusbar-left.png");
        defaults.add("StatusBar.middleImage", "resources/statusbar-middle.png");
        defaults.add("StatusBar.rightImage", "resources/statusbar-right.png");
      }
    } else {
      defaults.add(JXStatusBar.uiClassID,
          "org.jdesktop.swingx.plaf.windows.WindowsClassicStatusBarUI");
    }
  }
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

new ColorUIResource(Color.decode("#005C5C"))));
} else if (addon instanceof WindowsLookAndFeelAddons) {     
 String xpStyle = OS.getWindowsVisualStyle();
 ColorUIResource background;
 Color backgroundGradientStart;
  backgroundGradientEnd = new Color(177, 179, 200);
 } else {        
  if (OS.isWindowsVista()) {
   final Toolkit toolkit = Toolkit.getDefaultToolkit();
   background = new ColorUIResource((Color)toolkit.getDesktopProperty("win.3d.backgroundColor"));

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-plaf

/**
   * {@inheritDoc}
   */
  @Override
  protected boolean isSystemAddon() {
    return OS.isMacOSX();
  }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc}
 */
@Override
protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
  super.addWindowsDefaults(addon, defaults);
  if (OS.isWindowsXP() && OS.isUsingWindowsVisualStyles()) {
    defaults.add("JXDatePicker.arrowIcon",
        LookAndFeel.makeIcon(DatePickerAddon.class, "windows/resources/combo-xp.png"));
  } else {
    defaults.add("JXDatePicker.arrowIcon",
        LookAndFeel.makeIcon(DatePickerAddon.class, "windows/resources/combo-w2k.png"));
  }
}

代码示例来源:origin: tmyroadctfig/swingx

/**
 * @return true if the VM is running Windows and the Java
 *         application is rendered using XP Visual Styles.
 */
public static boolean isUsingWindowsVisualStyles() {
 if (!isWindows()) {
  return false;
 }
 boolean xpthemeActive = Boolean.TRUE.equals(Toolkit.getDefaultToolkit()
   .getDesktopProperty("win.xpstyle.themeActive"));
 if (!xpthemeActive) {
  return false;
 } else {
  try {
   return System.getProperty("swing.noxp") == null;
  } catch (RuntimeException e) {
   return true;
  }
 }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-plaf

/**
 * {@inheritDoc}
 */
@Override
protected boolean isSystemAddon() {
  return OS.isLinux();
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

} else if ("com.sun.java.swing.plaf.windows.WindowsLookAndFeel".equals(lnf) ||
 "com.jgoodies.looks.windows.WindowsLookAndFeel".equals(lnf)) {
 if (OS.isUsingWindowsVisualStyles()) {
  addon = WindowsLookAndFeelAddons.class.getName();
 } else {

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * Hack around the oversized vista header border installed by core.
 * Registers a (5,5,5,5) empty border for vista themes. Does nothing if the
 * OS is not Vista or the addon is classic windows or the JVM isn't 1.5. 
 * 
 * PENDING: can we have XP themes under vista? If so, this needs to be changed - 
 * most probably the xp border is okay.
 * 
 * @param addon
 * @param defaults
 */
private void hackVistaHeaderBorder(LookAndFeelAddons addon, DefaultsList defaults) {
  // do nothing if not vista or for classic design under vista
  if (!OS.isWindowsVista() || (addon instanceof WindowsClassicLookAndFeelAddons)
      || !JVM.current().isOneDotFive())
    return;
  defaults.add(ColumnHeaderRenderer.VISTA_BORDER_HACK,
      new BorderUIResource.EmptyBorderUIResource(5, 5, 5, 5));
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * {@inheritDoc}
 */
@Override
protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
  super.addWindowsDefaults(addon, defaults);
  
  if (OS.isWindowsXP()) {
    defaults.add(ColumnHeaderRenderer.UP_ICON_KEY,
        LookAndFeel.makeIcon(ColumnHeaderRendererAddon.class, "windows/resources/sort-xp-up.png"));
    defaults.add(ColumnHeaderRenderer.DOWN_ICON_KEY,
        LookAndFeel.makeIcon(ColumnHeaderRendererAddon.class, "windows/resources/sort-xp-dn.png"));
  } else {
    defaults.add(ColumnHeaderRenderer.UP_ICON_KEY,
        LookAndFeel.makeIcon(ColumnHeaderRendererAddon.class, "windows/resources/sort-w2k-up.png"));
    defaults.add(ColumnHeaderRenderer.DOWN_ICON_KEY,
        LookAndFeel.makeIcon(ColumnHeaderRendererAddon.class, "windows/resources/sort-w2k-dn.png"));
  }
  
  hackVistaHeaderBorder(addon, defaults);
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

@Override
  protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
    super.addWindowsDefaults(addon, defaults);
    if (OS.isUsingWindowsVisualStyles()) {
      defaults.add(JXStatusBar.uiClassID,
          "org.jdesktop.swingx.plaf.windows.WindowsStatusBarUI");
      
      String xpStyle = OS.getWindowsVisualStyle();
      
      if (WindowsLookAndFeelAddons.SILVER_VISUAL_STYLE.equalsIgnoreCase(xpStyle)
          || WindowsLookAndFeelAddons.VISTA_VISUAL_STYLE.equalsIgnoreCase(xpStyle)) {
        defaults.add("StatusBar.leftImage", "resources/silver-statusbar-left.png");
        defaults.add("StatusBar.middleImage", "resources/silver-statusbar-middle.png");
        defaults.add("StatusBar.rightImage", "resources/silver-statusbar-right.png");
      } else {
        defaults.add("StatusBar.leftImage", "resources/statusbar-left.png");
        defaults.add("StatusBar.middleImage", "resources/statusbar-middle.png");
        defaults.add("StatusBar.rightImage", "resources/statusbar-right.png");
      }
    } else {
      defaults.add(JXStatusBar.uiClassID,
          "org.jdesktop.swingx.plaf.windows.WindowsClassicStatusBarUI");
    }
  }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
   * {@inheritDoc}
   */
  @Override
  protected boolean isSystemAddon() {
    return OS.isWindows() && !OS.isUsingWindowsVisualStyles();
  }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

new ColorUIResource(Color.decode("#005C5C"))));
} else if (addon instanceof WindowsLookAndFeelAddons) {     
 String xpStyle = OS.getWindowsVisualStyle();
 ColorUIResource background;
 Color backgroundGradientStart;
  backgroundGradientEnd = new Color(177, 179, 200);
 } else {        
  if (OS.isWindowsVista()) {
   final Toolkit toolkit = Toolkit.getDefaultToolkit();
   background = new ColorUIResource((Color)toolkit.getDesktopProperty("win.3d.backgroundColor"));

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
   * {@inheritDoc}
   */
  @Override
  protected boolean isSystemAddon() {
    return OS.isMacOSX();
  }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
 * {@inheritDoc}
 */
@Override
protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
  super.addWindowsDefaults(addon, defaults);
  if (OS.isWindowsXP() && OS.isUsingWindowsVisualStyles()) {
    defaults.add("JXDatePicker.arrowIcon",
        LookAndFeel.makeIcon(DatePickerAddon.class, "windows/resources/combo-xp.png"));
  } else {
    defaults.add("JXDatePicker.arrowIcon",
        LookAndFeel.makeIcon(DatePickerAddon.class, "windows/resources/combo-w2k.png"));
  }
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-common

/**
 * @return true if the VM is running Windows and the Java
 *         application is rendered using XP Visual Styles.
 */
public static boolean isUsingWindowsVisualStyles() {
 if (!isWindows()) {
  return false;
 }
 boolean xpthemeActive = Boolean.TRUE.equals(Toolkit.getDefaultToolkit()
   .getDesktopProperty("win.xpstyle.themeActive"));
 if (!xpthemeActive) {
  return false;
 } else {
  try {
   return System.getProperty("swing.noxp") == null;
  } catch (RuntimeException e) {
   return true;
  }
 }
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-plaf

/**
 * {@inheritDoc}
 */
@Override
protected boolean isSystemAddon() {
  return OS.isLinux();
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc}
 */
@Override
protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
  super.addWindowsDefaults(addon, defaults);
  
  if (OS.isUsingWindowsVisualStyles()) {
    String xpStyle = OS.getWindowsVisualStyle();
    
    if (WindowsLookAndFeelAddons.HOMESTEAD_VISUAL_STYLE
        .equalsIgnoreCase(xpStyle)) {
      defaults.add("UIColorHighlighter.stripingBackground", new ColorUIResource(228, 231, 219));
    } else if (WindowsLookAndFeelAddons.SILVER_VISUAL_STYLE
        .equalsIgnoreCase(xpStyle)) {
      defaults.add("UIColorHighlighter.stripingBackground", new ColorUIResource(235, 235, 236));
    } else {
      // default blue
      defaults.add("UIColorHighlighter.stripingBackground", new ColorUIResource(224, 233, 246));
    }
    
  } else {
    defaults.add("UIColorHighlighter.stripingBackground", new ColorUIResource(218, 222, 233));
  }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
 * {@inheritDoc}
 */
@Override
protected boolean isSystemAddon() {
  return OS.isWindows() && OS.isUsingWindowsVisualStyles();
}

相关文章