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

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

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

UIManager.get介绍

暂无

代码示例

代码示例来源:origin: kiegroup/optaplanner

public static void increaseDefaultFont(float multiplier) {
  for (Enumeration keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {
    Object key = keys.nextElement();
    Object value = UIManager.get(key);
    if (value != null && value instanceof FontUIResource) {
      FontUIResource fontUIResource = (FontUIResource) value;
      UIManager.put(key, fontUIResource.deriveFont(fontUIResource.getSize() * multiplier));
    }
  }
}

代码示例来源:origin: groovy/groovy-core

children.add(tcr.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, focused));
} else if (list != null) {
  ListCellRenderer lcr = (ListCellRenderer) UIManager.get("List.cellRenderer");
  if (lcr == null) {
    lcr = new DefaultListCellRenderer();

代码示例来源:origin: winder/Universal-G-Code-Sender

ims.add((InputMap) UIManager.get("TextField.focusInputMap"));
ims.add((InputMap) UIManager.get("TextArea.focusInputMap"));
ims.add((InputMap) UIManager.get("EditorPane.focusInputMap"));
ims.add((InputMap) UIManager.get("FormattedTextField.focusInputMap"));
ims.add((InputMap) UIManager.get("PasswordField.focusInputMap"));
ims.add((InputMap) UIManager.get("TextPane.focusInputMap"));

代码示例来源:origin: org.netbeans.api/org-openide-awt

Object cfs = UIManager.get("customFontSize"); //NOI18N

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

/**
 * Sets default Swing font.
 * IMPORTANT! Needs to be called before main frame creation
 *
 * @param font the new font to use
 */
public static void setFont(@Nonnull final Font font)
{
  final FontUIResource f = new FontUIResource(font);
  final Enumeration keys = UIManager.getDefaults().keys();
  while (keys.hasMoreElements())
  {
    final Object key = keys.nextElement();
    final Object value = UIManager.get(key);
    if (value instanceof FontUIResource)
    {
      UIManager.put(key, f);
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

private static RGBImageFilter getImageIconFilter() {
  if( null == imageIconFilter ) {
    Object obj = UIManager.get( "nb.imageicon.filter"); //NOI18N
    if( obj instanceof RGBImageFilter ) {
      imageIconFilter = ( RGBImageFilter ) obj;
    }
  }
  return imageIconFilter;
}

代码示例来源:origin: wiztools/rest-client

private static void setGlobalUIFontSize(final int fontSize){
  Font f = new Font(Font.DIALOG, Font.PLAIN, fontSize);
  //UIManager.put("Label.font", f);
  //UIManager.put("Button.font", f);
  //UIManager.put("RadioButton.font", f);
  ArrayList<String> excludes = new ArrayList<>();
  //excludes.add("TitledBorder.font");
  //excludes.add("MenuBar.font");
  //excludes.add("MenuItem.font");
  //excludes.add("MenuItem.acceleratorFont");
  //excludes.add("Menu.font");
  //excludes.add("TabbedPane.font");
  excludes.add("");
  
  Enumeration itr = UIManager.getDefaults().keys();
  while(itr.hasMoreElements()){
    Object o = itr.nextElement();
    if(o instanceof String) {
      String key = (String) o;
      Object value = UIManager.get (key);
      if ((value instanceof javax.swing.plaf.FontUIResource)
          && (!excludes.contains(key))){
        LOG.fine(key);
        UIManager.put (key, f);
      }
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

private int getDefaultSplitterSize() {
  Object o = UIManager.get("nb.SplittedPanel.dividerSize"); //NOI18N
  if (o != null) {
    return ((Integer) o).intValue();
  }
  o = UIManager.get("SplitPane.dividerSize"); //NOI18N
  if (o != null) {
    return ((Integer) o).intValue();
  }
  return 6;
}

代码示例来源:origin: magefree/mage

public static void setDefaultFont (Font font) {
    for (Object key : Collections.list(UIManager.getDefaults().keys())) {
      Object value = UIManager.get(key);
      if (value instanceof javax.swing.plaf.FontUIResource) {
        UIManager.put(key, font);
      }
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

static int getInt(Object key, int defaultValue) {
  Object value = UIManager.get(key);
  if (value instanceof Integer) {
    return ((Integer)value).intValue();
  }
  if (value instanceof String) {
    try {
      return Integer.parseInt((String)value);
    } catch (NumberFormatException nfe) {
      // ignore
    }
  }
  return defaultValue;
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

Integer defaultSize = (Integer) UIManager.get("nbDefaultFontSize");

代码示例来源:origin: org.netbeans.api/org-openide-awt

/** Updates splitting, too. */
public void updateUI() {
  super.updateUI();
  updateSplitting();
  Object o = UIManager.get("nb.SplittedPanel.drawBumps");
  drawBumps = Boolean.TRUE.equals(o);
}

代码示例来源:origin: pentaho/mondrian

public Component getListCellRendererComponent(
    JList list,
    Object value,
    int index,
    boolean isSelected,
    boolean cellHasFocus)
  {
    // Ask the standard renderer for what it thinks is right
    Component c =
      std.getListCellRendererComponent(
        list,
        value,
        index,
        isSelected,
        cellHasFocus);
    if (!isSelected) {
      // Set the background of the returned component to Aqua
      // striped background, but only for unselected cells;
      // The standard renderer functions as desired for
      // highlighted cells.
      c.setBackground((Color)UIManager.get("ComboBox.background"));
    }
    return c;
  }
}

代码示例来源:origin: ron190/jsql-injection

public static boolean drawGradient(Component c, Graphics g, String key,
              int x, int y, int w, int h, boolean vertical) {
  List<Object> gradient = (List<Object>)UIManager.get(key);
  if (gradient == null || !(g instanceof Graphics2D)) {
    return false;

代码示例来源:origin: ron190/jsql-injection

static Icon getOceanDisabledButtonIcon(Image image) {
  Object[] range = (Object[])UIManager.get("Button.disabledGrayRange");
  int min = 180;
  int max = 215;
  if (range != null) {
    min = ((Integer)range[0]).intValue();
    max = ((Integer)range[1]).intValue();
  }
  ImageProducer prod = new FilteredImageSource(image.getSource(),
         new OceanDisabledButtonImageFilter(min , max));
  return new ImageIconUIResource(Toolkit.getDefaultToolkit().createImage(prod));
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Get the InputMap to use for the UI.<p>
 *
 * This method is not named <code>getInputMap()</code> because there is
 * a package-private method in <code>BasicTextAreaUI</code> with that name.
 * Thus, creating a new method with that name causes certain compilers to
 * issue warnings that you are not actually overriding the original method
 * (since it is package-private).
 */
protected InputMap getRTextAreaInputMap() {
  InputMap map = new InputMapUIResource();
  InputMap shared = (InputMap)UIManager.get(SHARED_INPUT_MAP_NAME);
  if (shared==null) {
    shared = new RTADefaultInputMap();
    UIManager.put(SHARED_INPUT_MAP_NAME, shared);
  }
  //KeyStroke[] keys = shared.allKeys();
  //for (int i=0; i<keys.length; i++)
  //	System.err.println(keys[i] + " -> " + shared.get(keys[i]));
  map.setParent(shared);
  return map;
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Get the InputMap to use for the UI.<p>
 *
 * This method is not named <code>getInputMap()</code> because there is
 * a package-private method in <code>BasicTextAreaUI</code> with that name.
 * Thus, creating a new method with that name causes certain compilers to
 * issue warnings that you are not actually overriding the original method
 * (since it is package-private).
 */
@Override
protected InputMap getRTextAreaInputMap() {
  InputMap map = new InputMapUIResource();
  InputMap shared = (InputMap)UIManager.get(SHARED_INPUT_MAP_NAME);
  if (shared==null) {
    shared = new RSyntaxTextAreaDefaultInputMap();
    UIManager.put(SHARED_INPUT_MAP_NAME, shared);
  }
  //KeyStroke[] keys = shared.allKeys();
  //for (int i=0; i<keys.length; i++)
  //	System.err.println(keys[i] + " -> " + shared.get(keys[i]));
  map.setParent(shared);
  return map;
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Returns an action map to use by a text area.<p>
 *
 * This method is not named <code>getActionMap()</code> because there is
 * a package-private method in <code>BasicTextAreaUI</code> with that name.
 * Thus, creating a new method with that name causes certain compilers to
 * issue warnings that you are not actually overriding the original method
 * (since it is package-private).
 *
 * @return The action map.
 * @see #createRTextAreaActionMap()
 */
private ActionMap getRTextAreaActionMap() {
  // Get the UIManager-cached action map; if this is the first
  // RTextArea created, create the action map and cache it.
  ActionMap map = (ActionMap)UIManager.get(getActionMapName());
  if (map==null) {
    map = createRTextAreaActionMap();
    UIManager.put(getActionMapName(), map);
  }
  ActionMap componentMap = new ActionMapUIResource();
  componentMap.put("requestFocus", new FocusAction());
  if (map != null) {
    componentMap.setParent(map);
  }
  return componentMap;
}

代码示例来源:origin: ron190/jsql-injection

this.host = url.getHost();
this.setFont(new Font(HelperUi.FONT_NAME_UBUNTU_MONO, Font.PLAIN, ((Font) UIManager.get("TextPane.font")).getSize()));
this.setCaret(new BlockCaret());
this.setBackground(Color.BLACK);

代码示例来源:origin: magefree/mage

Object value = UIManager.get("SplitPane.ancestorInputMap");

相关文章