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

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

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

JCheckBox.getFont介绍

暂无

代码示例

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

@Override
public Component getComponent(
  final JTree tree, Object nodeRenderer, final boolean isSelected, boolean isLeaf, boolean hasFocus
) {
  JCheckBox checkbox = new JCheckBox(this.toString(), this.isSelected());
  checkbox.setFont(
    checkbox.getFont().deriveFont(
      Font.PLAIN | Font.ITALIC,
      checkbox.getFont().getSize()
    )
  );
  
  checkbox.setText(StringUtil.detectUtf8HtmlNoWrap(this.toString()));
  
  if (isSelected) {
    if (hasFocus) {
      checkbox.setBackground(HelperUi.COLOR_FOCUS_GAINED);
      checkbox.setBorder(HelperUi.BORDER_FOCUS_GAINED);
    } else {
      checkbox.setBackground(HelperUi.COLOR_FOCUS_LOST);
      checkbox.setBorder(HelperUi.BORDER_FOCUS_LOST);
    }
  } else {
    checkbox.setBackground(Color.WHITE);
    checkbox.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
  }
  
  checkbox.setComponentOrientation(ComponentOrientation.getOrientation(I18n.getLocaleDefault()));
  return checkbox;
}

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

boolean previousState = checkbox.isSelected();
checkbox.setSelected(false);
FontMetrics boxFontMetrics =  checkbox.getFontMetrics(checkbox.getFont());
Icon boxIcon = UIManager.getIcon("CheckBox.icon");
BufferedImage boxImage = new BufferedImage(

代码示例来源:origin: org.codehaus.mevenide/nb-project

private void setCheckBoxValue(Boolean value, boolean defValue, JCheckBox component) {
  if (value != null) {
    component.setSelected(value.booleanValue());
    component.setToolTipText(""); //NOI18N
    inherited = false;
    component.setFont(component.getFont().deriveFont(Font.BOLD));
  } else {
    component.setSelected(defValue);
    component.setToolTipText(NbBundle.getMessage(CheckBoxUpdater.class, "MSG_Value_Inherited")); //NOI18N
    inherited = true;
    component.setFont(component.getFont().deriveFont(Font.PLAIN));
 }
}

代码示例来源:origin: org.codehaus.mevenide/nb-project

private void setModelValue() {
  if (inherited) {
    inherited = false;
    component.setFont(component.getFont().deriveFont(Font.BOLD));
    
    component.setToolTipText(""); //NOI18N
  }
  boolean val = component.isSelected();
  setValue(val == getDefaultValue() ? null : val);
}

代码示例来源:origin: senbox-org/snap-desktop

private void fill(WorldWindow wwd) {
  final String[] productNames = defaultProductLayer.getProductNames();
  for (String name : productNames) {
    final LayerAction action = new LayerAction(defaultProductLayer, wwd, name, defaultProductLayer.getOpacity(name) != 0);
    final JCheckBox jcb = new JCheckBox(action);
    jcb.setSelected(action.selected);
    this.layersPanel.add(jcb);
    if (defaultFont == null) {
      this.defaultFont = jcb.getFont();
    }
  }
}

代码示例来源:origin: igniterealtime/Spark

@SuppressWarnings({ "unchecked", "rawtypes" })
public void updateTitleFont() {
  if (task.isCompleted()) {
    Font font = box.getFont();
    
  Map attribs = font.getAttributes();
    attribs.put(TextAttribute.STRIKETHROUGH, true);
    box.setFont(new Font(attribs));
    box.setSelected(true);
  }
  else {
    Font font = box.getFont();
  Map Attribs = font.getAttributes();
    Attribs.put(TextAttribute.STRIKETHROUGH, false);
    box.setFont(new Font(Attribs));
    box.setSelected(false);
  }
}

代码示例来源:origin: edu.stanford.protege/explanation-workbench

private void createUI() {
  setLayout(new BorderLayout(2, 2));
  JPanel headerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
  JLabel label = new JLabel("Explanation " + explanationNumber);
  headerPanel.add(label);
  displayLaconicCheckBox.setFont(displayLaconicCheckBox.getFont().deriveFont(10.0f));
  displayLaconicCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
  displayLaconicCheckBox.setAction(new AbstractAction("Display laconic explanation") {
    public void actionPerformed(ActionEvent e) {
      displayLaconicExplanation(displayLaconicCheckBox.isSelected());
    }
  });
  if (workbenchManager.getWorkbenchSettings().getJustificationType().equals(JustificationType.LACONIC)) {
    displayLaconicCheckBox.setEnabled(false);
  }
  headerPanel.add(displayLaconicCheckBox);
  add(headerPanel, BorderLayout.NORTH);
  JPanel displayHolder = new JPanel(new BorderLayout());
  Border marginBorder = BorderFactory.createEmptyBorder(0, 20, 0, 0);
  Border lineBorder = BorderFactory.createLineBorder(Color.LIGHT_GRAY);
  displayHolder.setBorder(BorderFactory.createCompoundBorder(marginBorder, lineBorder));
  displayHolder.add((JComponent) display);
  add(displayHolder);
}

代码示例来源:origin: senbox-org/snap-desktop

private void fill(WorldWindow wwd) {
  // Fill the layers panel with the titles of all layers in the world window's current model.
  for (Layer layer : wwd.getModel().getLayers()) {
    if (layer.getName().equalsIgnoreCase("Atmosphere") || layer.getName().equalsIgnoreCase("World Map") ||
        layer.getName().equalsIgnoreCase("Scale bar") || layer.getName().equalsIgnoreCase("Compass"))
      continue;
    final LayerAction action = new LayerAction(layer, wwd, layer.isEnabled());
    final JCheckBox jcb = new JCheckBox(action);
    jcb.setSelected(action.selected);
    this.layersPanel.add(jcb);
    if (defaultFont == null) {
      this.defaultFont = jcb.getFont();
    }
  }
}

代码示例来源:origin: MegaMek/mekhq

private JCheckBox createOptionCheckBox(String text, Icon checkboxIcon, Icon checkboxSelectedIcon) {
  JCheckBox checkBox = new JCheckBox(text);
  checkBox.setOpaque(false);
  checkBox.setForeground(new Color(150, 220, 255));
  checkBox.setFocusable(false);
  checkBox.setFont(checkBox.getFont().deriveFont(Font.BOLD));
  checkBox.setPreferredSize(new Dimension(150, 20));
  checkBox.setIcon(checkboxIcon);
  checkBox.setSelectedIcon(checkboxSelectedIcon);
  checkBox.setSelected(false);
  checkBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      repaint();
    }
  });
  return checkBox;
}

代码示例来源:origin: omegat-org/omegat

jTextArea1.setFont(dontAskCheckBox.getFont());
jTextArea1.setLineWrap(true);
jTextArea1.setText(OStrings.getString("ISSUE_PROVIDERS_SELECTOR_MESSAGE")); // NOI18N

代码示例来源:origin: org.scijava/scijava-search

headerBox.setFont(smaller(headerBox.getFont(), 2));
if (parent != null) headerBox.setBackground(parent.getBackground());
headerCheckboxes.put(searcher.getClass(), headerBox);

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

showImportsCheckBox.setFont(showImportsCheckBox.getFont().deriveFont(Font.PLAIN, 11.0f));
add(showImportsCheckBox, BorderLayout.SOUTH);
tree.setCellRenderer(new OntologyTreeCellRenderer());

代码示例来源:origin: otros-systems/otroslogviewer

showHidCheckBox.setToolTipText(Messages.getMessage("browser.showHidden.tooltip"));
showHidCheckBox.setMnemonic(Messages.getMessage("browser.showHidden.mnemonic").charAt(0));
Font tmpFont = showHidCheckBox.getFont();
showHidCheckBox.setFont(tmpFont.deriveFont(tmpFont.getSize() * 0.9f));
showHidCheckBox.addActionListener(e -> updateUiFilters());

代码示例来源:origin: org.protege/protege-editor-owl

showImportsCheckBox.setFont(showImportsCheckBox.getFont().deriveFont(Font.PLAIN, 11.0f));
add(showImportsCheckBox, BorderLayout.SOUTH);
tree.setCellRenderer(new OntologyTreeCellRenderer());

代码示例来源:origin: GoldenGnu/jeveassets

jAll.setActionCommand(TrackerAction.ALL.name());
jAll.addActionListener(listener);
jAll.setFont(new Font(jAll.getFont().getName(), Font.ITALIC, jAll.getFont().getSize()));

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

leafRenderer.setFont(leafRenderer.getFont().deriveFont(Font.ITALIC));
leafRenderer.setFont(leafRenderer.getFont().deriveFont(Font.BOLD));

相关文章

JCheckBox类方法