javax.swing.UIManager.getDimension()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(95)

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

UIManager.getDimension介绍

暂无

代码示例

代码示例来源:origin: org.java.net.substance/substance

/**
 * Returns the default icon size that is used in menus, menu items and
 * toolbars. Menu items that have no icon set are aligned using the default
 * icon dimensions.
 * 
 * @return the dimension of the default icon
 * @see #setDefaultIconSize(Dimension)
 */
public static Dimension getDefaultIconSize() {
  Dimension size = UIManager.getDimension(DEFAULT_ICON_SIZE_KEY);
  return size == null ? DEFAULT_ICON_SIZE : size;
}

代码示例来源:origin: com.github.insubstantial/substance

/**
 * Returns the default icon size that is used in menus, menu items and
 * toolbars. Menu items that have no icon set are aligned using the default
 * icon dimensions.
 * 
 * @return the dimension of the default icon
 * @see #setDefaultIconSize(Dimension)
 */
public static Dimension getDefaultIconSize() {
  Dimension size = UIManager.getDimension(DEFAULT_ICON_SIZE_KEY);
  return size == null ? DEFAULT_ICON_SIZE : size;
}

代码示例来源:origin: com.fifesoft.rtext/fife.common

/**
 * Returns the default icon size that is used in menus, menu items and
 * toolbars. Menu items that have no icon set are aligned using the default
 * icon dimensions.
 *
 * @return the dimension of the default icon
 *
 * @see #setDefaultIconSize(Dimension)
 */
public static Dimension getDefaultIconSize() {
  Dimension size = UIManager.getDimension(DEFAULT_ICON_SIZE_KEY);
  return size == null ? DEFAULT_ICON_SIZE : size;
}

代码示例来源:origin: org.java.net.substance/substance

protected void initValues() {
  defaultSwatchSize = UIManager.getDimension("ColorChooser.swatchesSwatchSize");
  swatchSize.width = defaultSwatchSize.width;
  swatchSize.height = defaultSwatchSize.height;
  gap = new Dimension(1, 1);
}

代码示例来源:origin: com.github.insubstantial/substance

protected void initValues() {
  defaultSwatchSize = UIManager.getDimension("ColorChooser.swatchesSwatchSize");
  swatchSize.width = defaultSwatchSize.width;
  swatchSize.height = defaultSwatchSize.height;
  gap = new Dimension(1, 1);
}

代码示例来源:origin: net.java.abeille/abeille

public RecentSwatchPanel() {
  Color default_color = UIManager.getColor("ColorChooser.swatchesDefaultRecentColor");
  if (default_color == null)
    default_color = UIManager.getColor("control");
  if (default_color == null)
    default_color = Color.gray;
  m_default_color = new ColorHolder(default_color);
  m_colors = RecentColorsModel.createInstance(SWATCH_ROWS * SWATCH_COLUMNS);
  m_swatch_size = UIManager.getDimension("ColorChooser.swatchesRecentSwatchSize");
  if (m_swatch_size == null)
    m_swatch_size = new Dimension(10, 10);
  m_gap = new Dimension(1, 1);
  setToolTipText("");
  setRequestFocusEnabled(false);
  setBorder(javax.swing.BorderFactory.createLineBorder(Color.black));
}

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

/**
 * Returns a dimension from the defaults. If the value for {@code key} is
 * not a {@code Dimension}, {@code defaultDimension} is returned.
 * 
 * @param key
 *                an {@code Object} specifying the dimension
 * @param defaultDimension
 *                the dimension to return if the dimension specified by
 *                {@code key} does not exist
 * @return the {@code Dimension} object
 * @throws NullPointerException
 *                 if {@code key} or {@code defaultColor} is {@code null}
 */
public static Dimension getSafeDimension(Object key, Dimension defaultDimension) {
  Contract.asNotNull(defaultDimension, "defaultDimension cannot be null");
  
  Dimension safeDimension = UIManager.getDimension(key);
  
  if (safeDimension == null) {
    safeDimension = defaultDimension;
  }
  
  if (!(safeDimension instanceof UIResource)) {
    safeDimension = new DimensionUIResource(safeDimension.width, safeDimension.height);
  }
  
  return safeDimension;
}

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

/**
 * Returns a dimension from the defaults. If the value for {@code key} is
 * not a {@code Dimension}, {@code defaultDimension} is returned.
 * 
 * @param key
 *                an {@code Object} specifying the dimension
 * @param defaultDimension
 *                the dimension to return if the dimension specified by
 *                {@code key} does not exist
 * @return the {@code Dimension} object
 * @throws NullPointerException
 *                 if {@code key} or {@code defaultColor} is {@code null}
 */
public static Dimension getSafeDimension(Object key, Dimension defaultDimension) {
  Contract.asNotNull(defaultDimension, "defaultDimension cannot be null");
  
  Dimension safeDimension = UIManager.getDimension(key);
  
  if (safeDimension == null) {
    safeDimension = defaultDimension;
  }
  
  if (!(safeDimension instanceof UIResource)) {
    safeDimension = new DimensionUIResource(safeDimension.width, safeDimension.height);
  }
  
  return safeDimension;
}

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

/**
 * Returns a dimension from the defaults. If the value for {@code key} is
 * not a {@code Dimension}, {@code defaultDimension} is returned.
 * 
 * @param key
 *                an {@code Object} specifying the dimension
 * @param defaultDimension
 *                the dimension to return if the dimension specified by
 *                {@code key} does not exist
 * @return the {@code Dimension} object
 * @throws NullPointerException
 *                 if {@code key} or {@code defaultColor} is {@code null}
 */
public static Dimension getSafeDimension(Object key, Dimension defaultDimension) {
  Contract.asNotNull(defaultDimension, "defaultDimension cannot be null");
  
  Dimension safeDimension = UIManager.getDimension(key);
  
  if (safeDimension == null) {
    safeDimension = defaultDimension;
  }
  
  if (!(safeDimension instanceof UIResource)) {
    safeDimension = new DimensionUIResource(safeDimension.width, safeDimension.height);
  }
  
  return safeDimension;
}

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

/**
 * Returns a dimension from the defaults. If the value for {@code key} is
 * not a {@code Dimension}, {@code defaultDimension} is returned.
 * 
 * @param key
 *                an {@code Object} specifying the dimension
 * @param defaultDimension
 *                the dimension to return if the dimension specified by
 *                {@code key} does not exist
 * @return the {@code Dimension} object
 * @throws NullPointerException
 *                 if {@code key} or {@code defaultColor} is {@code null}
 */
public static Dimension getSafeDimension(Object key, Dimension defaultDimension) {
  Contract.asNotNull(defaultDimension, "defaultDimension cannot be null");
  
  Dimension safeDimension = UIManager.getDimension(key);
  
  if (safeDimension == null) {
    safeDimension = defaultDimension;
  }
  
  if (!(safeDimension instanceof UIResource)) {
    safeDimension = new DimensionUIResource(safeDimension.width, safeDimension.height);
  }
  
  return safeDimension;
}

相关文章