javax.swing.JComboBox.setFont()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(145)

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

JComboBox.setFont介绍

暂无

代码示例

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

public MenuControl(String nodePath, Port port) {
  super(nodePath, port);
  setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
  menuBox = new JComboBox<>();
  menuModel = new MenuDataModel(port);
  MenuItemRenderer menuItemRenderer = new MenuItemRenderer();
  menuBox.setModel(menuModel);
  menuBox.setRenderer(menuItemRenderer);
  menuBox.putClientProperty("JComponent.sizeVariant", "small");
  menuBox.putClientProperty("JComboBox.isPopDown", Boolean.TRUE);
  menuBox.setFont(Theme.SMALL_BOLD_FONT);
  menuBox.addActionListener(this);
  add(menuBox);
  setValueForControl(port.getValue());
}

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

public FontControl(String nodePath, Port port) {
  super(nodePath, port);
  setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
  fontChooser = new JComboBox<>();
  fontModel = new FontDataModel();
  FontCellRenderer fontCellRenderer = new FontCellRenderer();
  fontChooser.setModel(fontModel);
  fontChooser.setRenderer(fontCellRenderer);
  fontChooser.putClientProperty("JComponent.sizeVariant", "small");
  fontChooser.setPreferredSize(new Dimension(150, 22));
  fontChooser.putClientProperty("JComboBox.isPopDown", Boolean.TRUE);
  fontChooser.addActionListener(this);
  fontChooser.setFont(Theme.SMALL_BOLD_FONT);
  add(fontChooser);
  setValueForControl(port.getValue());
}

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

listRenderer.setFont(Font.decode("Dialog"));
listRenderer.setBackground(Color.white);
relationList.setPreferredSize(new Dimension(55, 22));
relationList.setMinimumSize(new Dimension(55, 22));
relationList.setFont(Font.decode("Dialog"));
relationList.setBackground(Color.white);

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

listEditor.setEditable(true);
listEditor.setMaximumSize(stringEditor.getMaximumSize());
listEditor.setFont(Font.decode("Dialog"));
listEditor.setBackground(Color.white);
listEditor.setBorder(

代码示例来源:origin: baishui2004/common_gui_tools

/**
 * 文件大小单位下拉框.
 */
public JComboBox createFileSizeUnitBox(Font font) {
  JComboBox fileSizeUnitBox = new JComboBox();
  fileSizeUnitBox.setFont(font);
  for (int i = 0; i < fileSizeUnit.length; i++) {
    fileSizeUnitBox.addItem(fileSizeUnit[i]);
  }
  fileSizeUnitBox.setSelectedIndex(1);
  return fileSizeUnitBox;
}

代码示例来源:origin: baishui2004/common_gui_tools

/**
 * 创建指定下拉Items、字体及ActionListener的JComboBox,并选择特定位置的Item.
 */
public JComboBox createJComboBox(String[] items, Integer selectIndex, Font font, ActionListener listener) {
  JComboBox comboBox = new JComboBox();
  comboBox.setFont(font);
  for (int i = 0; i < items.length; i++) {
    comboBox.addItem(items[i]);
  }
  comboBox.setSelectedIndex(selectIndex);
  comboBox.addActionListener(listener);
  return comboBox;
}

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

/**
 * Sets the font for this component.
 *
 * @param font
 *            the desired <code>Font</code> for this component
 */
@Override
public void setFont(final Font font) {
  if (comboBox != null) {
    comboBox.setFont(font);
  }
  super.setFont(font);
}

代码示例来源:origin: semuxproject/semux-core

/**
 * Generates a text field with copy-paste-cut popup menu.
 *
 * @return
 */
public static <T> JComboBox<T> comboBoxWithCopyPastePopup() {
  JComboBox<T> textField = new JComboBox<>();
  textField.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 13));
  addTextContextMenu(textField, Arrays.asList(COPY, PASTE, CUT));
  addTextMouseClickFocusListener(textField);
  return textField;
}

代码示例来源:origin: net.sf.sfac/sfac-core

@Override
protected void fireObjectSelectionChanged() {
  super.fireObjectSelectionChanged();
  JComboBox comboBox = getComboBox();
  Font selected = (Font) comboBox.getSelectedItem();
  if (selected == null) selected = DEFAULT_FONT;
  comboBox.setFont(selected);
}

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

/** Creates new form. */
public ColorSlidersChooser() {
  initComponents();
  slidersComboBox.setFont(UIManager.getFont("ColorChooser.font"));
}

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

/** Creates new form. */
public ColorSlidersChooser() {
  initComponents();
  slidersComboBox.setFont(UIManager.getFont("ColorChooser.font"));
}

代码示例来源:origin: pentaho/pentaho-reporting

protected void configureEditorStyle( final Font font, final Color foreground, final Color background ) {
 comboBox.setFont( font );
 comboBox.setForeground( foreground );
 comboBox.setBackground( background );
}

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

public JComboBox getComboBox(String[] child) {
  JComboBox comboBox = new JComboBox<>(child);
  comboBox.setBackground(AppThemeColor.HEADER);
  comboBox.setForeground(AppThemeColor.TEXT_DEFAULT);
  comboBox.setFont(BOLD_FONT.deriveFont(scale * 16f));
  comboBox.setBorder(BorderFactory.createLineBorder(AppThemeColor.BORDER, 1));
  comboBox.setUI(MercuryComboBoxUI.createUI(comboBox));
  return comboBox;
}

代码示例来源:origin: BaseXdb/basex

@Override
public void setFont(final Font font) {
 super.setFont(font);
 final BaseXTextField tf = textField();
 if(hint != null && tf != null) hint.setFont(tf.getFont());
}

代码示例来源:origin: org.basex/basex

@Override
public void setFont(final Font font) {
 super.setFont(font);
 final BaseXTextField tf = textField();
 if(hint != null && tf != null) hint.setFont(tf.getFont());
}

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

@Override
public void installUI (JComponent c) {
  super.installUI (c);
  JComboBox<?> comboBox = (JComboBox<?>) c;
  comboBox.setFont (UIManager.getFont ("ComboBox.font"));
  comboBox.setBackground (UIManager.getColor ("ComboBox.background"));
  comboBox.setForeground (UIManager.getColor ("ComboBox.foreground"));
  comboBox.setBorder (UIManager.getBorder ("ComboBox.border"));
  comboBox.setLightWeightPopupEnabled (true);
  comboBox.setRenderer (new MaterialComboBoxRenderer ());
}

代码示例来源:origin: nroduit/Weasis

private static void initCombo(JComboBox<?> combo) {
  // Set before tooltip, otherwise update UI => remove selection listener
  combo.setFont(FontTools.getFont11());
  combo.setMaximumRowCount(15);
  JMVUtils.setPreferredWidth(combo, 80);
  // Update UI before adding the Tooltip feature in the combobox list
  combo.updateUI();
  JMVUtils.addTooltipToComboList(combo);
}

代码示例来源:origin: org.gdl-lang.gdl-tools/cds-gui-swing

private static void disable(JComboBox comboBox) {
  comboBox.setFocusable(false);
  comboBox.setUI(new DisabledComboUI());
  comboBox.setFont(comboBox.getFont().deriveFont(Font.PLAIN));
  ComboBoxEditor editor = comboBox.getEditor();
  if (editor != null && editor.getEditorComponent() instanceof JTextComponent) {
    ((JTextComponent) editor.getEditorComponent()).setEditable(false);
  }
}

代码示例来源:origin: org.biojava.thirdparty/forester

public JComboBox<String> getSequenceRelationBox() {
  if ( _show_sequence_relations == null ) {
    _show_sequence_relations = new JComboBox<String>();
    _show_sequence_relations.setFocusable( false );
    _show_sequence_relations.setMaximumRowCount( 20 );
    _show_sequence_relations.setFont( ControlPanel.js_font );
    if ( !_configuration.isUseNativeUI() ) {
      _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
      _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() );
    }
    _show_sequence_relations.addItem( "-----" );
    _show_sequence_relations.setToolTipText( "To display orthology information for selected query" );
  }
  return _show_sequence_relations;
}

相关文章

JComboBox类方法