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

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

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

UIManager.getDefaults介绍

暂无

代码示例

代码示例来源: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: 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: 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: marytts/marytts

jTabbedPane_Options.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jPanel_AudioOptions.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jLabel_AudioMixer.setText("Audio source:");
jPanel_TimingOptions.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jLabel_BufferAdded.setText("Buffer added to recording time:");
jPanel_DisplayOptions.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jCheckBox_SystemLookAndFeel.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jCheckBox_SystemLookAndFeel.setText("Use system look and feel (requires tool restart)");
jCheckBox_SystemLookAndFeel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBox_ShowTestOutput.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jCheckBox_ShowTestOutput.setText("Display test output in console");
jCheckBox_ShowTestOutput.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBox_ShowTranscription.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jCheckBox_ShowTranscription.setText("Show transcription");
jCheckBox_ShowTranscription.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBox_ShowPromptCount.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jCheckBox_ShowPromptCount.setText("Show prompt count and progress bar in Speaker Window");
jCheckBox_ShowPromptCount.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBox_RedAlertMode.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jCheckBox_RedAlertMode.setText("Red alert mode");
jCheckBox_RedAlertMode.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));

代码示例来源: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: magefree/mage

@Override
  public void paint(Graphics2D g, Object c, int w, int h) {
    g.setColor(color == null ? UIManager.getDefaults().getColor("desktop") : color);
    g.fillRect(0,0,w,h);
  }
};

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

public static Font defaultFont() {
  return UIManager.getDefaults().getFont("Label.font");
}

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

HelperUi.FONT_NAME_MONOSPACED,
  Font.PLAIN,
  UIManager.getDefaults().getFont("TextField.font").getSize()
));

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

Font controlFont = (Font) UIManager.getDefaults().get("controlFont"); //NOI18N
Integer defaultSize = (Integer) UIManager.get("nbDefaultFontSize");

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

(Color) UIManager.getDefaults().get(
    "CheckBoxMenuItem.acceleratorForeground"));
schemaLabel.setHorizontalAlignment(SwingConstants.CENTER);

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

HelperUi.FONT_NAME_MONOSPACED,
  Font.PLAIN,
  UIManager.getDefaults().getFont("TextField.font").getSize()
));
textarea.setText(

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

(Color) UIManager.getDefaults().get(
    "CheckBoxMenuItem.acceleratorForeground"));
targetLabel.setHorizontalAlignment(SwingConstants.CENTER);
  (Color) UIManager.getDefaults().get(
    "CheckBoxMenuItem.acceleratorForeground"));
targetLabel2.setHorizontalAlignment(SwingConstants.CENTER);

代码示例来源:origin: SKCraft/Launcher

public static void setSwingProperties(String appName) {
    UIManager.getDefaults().put("SplitPane.border", BorderFactory.createEmptyBorder());
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", appName);
    System.setProperty("apple.laf.useScreenMenuBar", "true");
  }
}

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-runtime

public static KeyStroke findKeyStroke(String name, String defaultValue) {
  String keyStrokeStr = UIManager.getDefaults().getString(name);
  if (keyStrokeStr == null) {
    keyStrokeStr = defaultValue;
  }
  return KeyStroke.getKeyStroke(keyStrokeStr);
}

代码示例来源:origin: com.incors/kunstoff-laf

public void addCustomEntriesToTable(UIDefaults table)
  {
    super.addCustomEntriesToTable(table);
    UIManager.getDefaults().put("PasswordField.font", monospacedFont);
    UIManager.getDefaults().put("TextArea.font", monospacedFont);
    UIManager.getDefaults().put("TextPane.font", monospacedFont);
    UIManager.getDefaults().put("EditorPane.font", monospacedFont);
  }
}

代码示例来源:origin: org.databene/databene-commons

private static Font defaultFont(boolean bold) {
  Font tableFont = UIManager.getDefaults().getFont("Table.font");
  if (tableFont.isBold() != bold)
    return new Font(tableFont.getFamily(), (bold ? Font.BOLD : Font.PLAIN), tableFont.getSize());
  else
    return tableFont;
}

代码示例来源:origin: com.synaptix/SynaptixWidget

@Override
public void initialize() {
  // A faire pour qu'il ne soit pas écrasé par la suite
  DockingUISettings.getInstance().installUI();
  // Effacer les ui qu'on va ecraser
  UIManager.getDefaults().remove("DockViewTitleBarUI");
  // UIManager.getDefaults().remove("DockViewTitleBar.border");
  UIManager.getDefaults().put("TableUI", MySubstanceTableUI.class.getName());
}

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

@Override
  public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
    super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
    
    SQLResultTable resultTable = (SQLResultTable) table;
    if (resultTable.getColumnOnSelect() == col) {
      setBackground(UIManager.getDefaults().getColor("Table.selectionBackground"));
    } else {
      setBackground(UIManager.getDefaults().getColor("Table.background"));
    }
    return this;
  }
}

代码示例来源:origin: net.sf.jga/jga

public Dimension getPreferredSize() {
  Border border = (Border) UIManager.getDefaults().get("TableHeader.cellBorder");
  Insets insets = border.getBorderInsets(_header);
  FontMetrics metrics = getFontMetrics(_headerFont);
  Dimension dim = new Dimension( metrics.stringWidth("99999") +insets.right +insets.left,
                  _table.getRowHeight() * _table.getRowCount());
  return dim;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-swing-plaf

/** Create a new instance of NBTheme */
public NbTheme(URL themeURL, LookAndFeel lf) {
  this.themeURL = themeURL;
  defaults = lf.getDefaults();
  initThemeDefaults();
  parseTheme();
  UIManager.getDefaults().putAll (defaults);
}

相关文章