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

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

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

UIManager.getFont介绍

暂无

代码示例

代码示例来源:origin: redwarp/9-Patch-Resizer

public AboutDialog(JFrame parent) {
  this.setResizable(false);
  this.setSize(new Dimension(400, 250));
  this.getContentPane().setLayout(new BorderLayout(0, 0));
  JLabel lblResizer = new JLabel(Localization.get("app_name") + " "
      + Configuration.getVersion());
  lblResizer.setBorder(new EmptyBorder(10, 10, 10, 10));
  lblResizer.setVerticalTextPosition(SwingConstants.BOTTOM);
  lblResizer.setIconTextGap(10);
  lblResizer.setFont(lblResizer.getFont().deriveFont(
      lblResizer.getFont().getStyle() | Font.BOLD, 16f));
  lblResizer.setIcon(new ImageIcon(AboutDialog.class
      .getResource("/img/icon_64.png")));
  this.getContentPane().add(lblResizer, BorderLayout.NORTH);
  JTextArea txtrResizerIsA = new JTextArea();
  txtrResizerIsA.setEditable(false);
  txtrResizerIsA.setWrapStyleWord(true);
  txtrResizerIsA.setBorder(new EmptyBorder(0, 10, 10, 10));
  txtrResizerIsA.setFont(UIManager.getFont("Label.font"));
  txtrResizerIsA.setLineWrap(true);
  txtrResizerIsA.setText(Localization.get("about_text"));
  txtrResizerIsA.setBackground(new Color(0, 0, 0, 0));
  this.getContentPane().add(txtrResizerIsA, BorderLayout.CENTER);
  this.setLocationRelativeTo(parent);
}

代码示例来源:origin: JetBrains/ideavim

private MyFontMetrics getFontMetrics(Editor editor) {
 String familyName = UIManager.getFont("Label.font").getFamily();
 int size = (int)(Math.max(1, editor.getColorsScheme().getEditorFontSize() - 1) * factor);
 MyFontMetrics metrics = editor.getUserData(HINT_FONT_METRICS);
 if (metrics != null && !metrics.isActual(editor, familyName, size)) {
  metrics = null;
 }
 if (metrics == null) {
  metrics = new MyFontMetrics(editor, familyName, size);
  editor.putUserData(HINT_FONT_METRICS, metrics);
 }
 return metrics;
}

代码示例来源:origin: stackoverflow.com

this.setFont(UIManager.getFont("TableHeader.font"));
this.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
this.setBackground(UIManager.getColor("TableHeader.background"));

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

ta.setLineWrap(true);
ta.setWrapStyleWord(true);
ta.setFont(UIManager.getFont("Label.font")); // NOI18N
ta.getAccessibleContext().setAccessibleDescription(""); // NOI18N
ta.setBorder(BorderFactory.createEmptyBorder());

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

) {
  if (f == null) {
    f = UIManager.getFont("controlFont"); //NOI18N

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

f = UIManager.getFont("controlFont"); //NOI18N

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

/** Restore the renderer to a pristine state */
public void reset() {
  parentFocused = false;
  setCentered(false);
  html = null;
  indent = 0;
  border = null;
  setIcon(null);
  setOpaque(false);
  selected = false;
  leadSelection = false;
  prefSize = null;
  type = Type.UNKNOWN;
  renderStyle = HtmlRenderer.STYLE_CLIP;
  setFont(UIManager.getFont("controlFont")); //NOI18N
  setIconTextGap(3);
  setEnabled(true);
  border = null;
  //Defensively ensure the insets haven't been messed with
  EMPTY_INSETS.top = 0;
  EMPTY_INSETS.left = 0;
  EMPTY_INSETS.right = 0;
  EMPTY_INSETS.bottom = 0;
}

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

Font font = UIManager.getFont("Label.font");
if (font == null) { // Try to make a sensible default
  font = new Font("SansSerif", Font.PLAIN, 12);

代码示例来源:origin: org.cytoscape/work-swing-impl

static JLabel newLabelWithFont(final int style, final int size) {
 final Font defaultFont = UIManager.getFont("Label.font");
 final Font font = new Font(defaultFont == null ? null : defaultFont.getName(), style, size);
 final JLabel label = new JLabel();
 label.setFont(font);
 label.setPreferredSize(new Dimension(DEFAULT_WIDTH, size));
 return label;
}

代码示例来源:origin: org.terracotta.modules/tim-ehcache-2.x-ui

public CheckBoxNodeRenderer() {
 Font fontValue = UIManager.getFont("Tree.font");
 if (fontValue != null) {
  checkBoxRenderer.setFont(fontValue);
 }
 Boolean booleanValue = (Boolean) UIManager.get("Tree.drawsFocusBorderAroundIcon");
 checkBoxRenderer.setFocusPainted((booleanValue != null) && (booleanValue.booleanValue()));
 selectionForeground = UIManager.getColor("Tree.selectionForeground");
 selectionBackground = UIManager.getColor("Tree.selectionBackground");
 textForeground = UIManager.getColor("Tree.textForeground");
 textBackground = UIManager.getColor("Tree.textBackground");
}

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

public TooltipBar() {
  DEFAULT_MESSAGE = Translator.get("shortcuts_panel.default_message");
  Font tableFont = UIManager.getFont("TableHeader.font");
  setFont(new Font(tableFont.getName(), Font.BOLD, tableFont.getSize()));
  setHorizontalAlignment(JLabel.LEFT);
  setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
  setText(DEFAULT_MESSAGE);
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

/**
 * Creates a new JComboBox.
 */
public <T> JComboBox<T> createComboBox() {
  JComboBox<T> comboBox = new JComboBox<>();
  comboBox.setFont(UIManager.getFont("Label.font"));
  comboBox.setBackground(Color.WHITE);
  comboBox.setMaximumRowCount(ModelerPreferences.COMBOBOX_MAX_VISIBLE_SIZE);
  return comboBox;
}

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

protected void installDefaults() {
 LookAndFeel.installColorsAndFont(tipPane, "TipOfTheDay.background",
  "TipOfTheDay.foreground", "TipOfTheDay.font");
 LookAndFeel.installBorder(tipPane, "TipOfTheDay.border");
 LookAndFeel.installProperty(tipPane, "opaque", Boolean.TRUE);
 tipFont = UIManager.getFont("TipOfTheDay.tipFont");
}

代码示例来源:origin: atarw/material-ui-swing

@Override
public void installUI (JComponent c) {
  super.installUI (c);
  JSpinner spinner = (JSpinner) c;
  spinner.setOpaque (false);
  spinner.setFont (UIManager.getFont ("Spinner.font"));
  spinner.setBackground (UIManager.getColor ("Spinner.background"));
  spinner.setForeground (UIManager.getColor ("Spinner.foreground"));
  spinner.setBorder (UIManager.getBorder ("Spinner.border"));
}

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

protected void installDefaults() {
 LookAndFeel.installColorsAndFont(tipPane, "TipOfTheDay.background",
  "TipOfTheDay.foreground", "TipOfTheDay.font");
 LookAndFeel.installBorder(tipPane, "TipOfTheDay.border");
 LookAndFeel.installProperty(tipPane, "opaque", Boolean.TRUE);
 tipFont = UIManager.getFont("TipOfTheDay.tipFont");
}

代码示例来源:origin: atarw/material-ui-swing

@Override
public void installUI (JComponent c) {
  super.installUI (c);
  JMenu menu = (JMenu) c;
  menu.setFont (UIManager.getFont ("Menu.font"));
  menu.setBorder (UIManager.getBorder ("Menu.border"));
  menu.setBackground (UIManager.getColor ("Menu.background"));
  menu.setForeground (UIManager.getColor ("Menu.foreground"));
  menu.setOpaque (UIManager.getBoolean ("Menu.opaque"));
}

代码示例来源:origin: atarw/material-ui-swing

@Override
public void installUI (JComponent c) {
  super.installUI (c);
  AbstractButton button = (AbstractButton) c;
  button.setOpaque (UIManager.getBoolean ("Button.opaque"));
  button.setBorder (UIManager.getBorder ("Button.border"));
  button.setBackground (UIManager.getColor ("Button.background"));
  button.setForeground (UIManager.getColor ("Button.foreground"));
  button.setFont (UIManager.getFont ("Button.font"));
}

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

public JSelectableLabel(String text) {
  super(text);
  this.setEditable(false);
  this.setBorder(null);
  this.setForeground(UIManager.getColor("Label.foreground"));
  this.setFont(UIManager.getFont("Label.font"));
  this.setOpaque(false);
}

代码示例来源:origin: protegeproject/protege

@Override
public void installUI(JComponent c) {
  super.installUI(c);
  if (OSUtils.isOSX()) {
    tabPane.setFont(OS_X_FONT);
  }
  else {
    tabPane.setFont(UIManager.getFont("TabbedPane.font"));
  }
}

代码示例来源:origin: org.gephi/ui-components

public JHTMLEditorPane() {
  super();
  setEditorKit(new HTMLEditorKit());
  setEditable(false);
  setOpaque(true);
  setAutoscrolls(true);
  addHyperlinkListener(this);
  setTransferHandler(new HTMLTextAreaTransferHandler());
  setFont(UIManager.getFont("Label.font")); //NOI18N
  addMouseListener(this);
}

相关文章