當前位置: 首頁>>代碼示例>>Java>>正文


Java JCheckBox.setFont方法代碼示例

本文整理匯總了Java中javax.swing.JCheckBox.setFont方法的典型用法代碼示例。如果您正苦於以下問題:Java JCheckBox.setFont方法的具體用法?Java JCheckBox.setFont怎麽用?Java JCheckBox.setFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JCheckBox的用法示例。


在下文中一共展示了JCheckBox.setFont方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addCheckBox

import javax.swing.JCheckBox; //導入方法依賴的package包/類
private void addCheckBox() {
    /* isDirected */

    directed = new JCheckBox("isDirected");
    directed.setBounds(635, 17, 125, 20);
    directed.setFont(checkBoxFont);
    directed.setMargin(DEFAULT_INSETS);

    /* hasWight */

    weight = new JCheckBox("hasWeight");
    weight.setBounds(530, 17, 100, 20);
    weight.setFont(checkBoxFont);
    weight.setMargin(DEFAULT_INSETS);
}
 
開發者ID:xehoth,項目名稱:VisualGraphviz,代碼行數:16,代碼來源:MainFrame.java

示例2: getListCellRendererComponent

import javax.swing.JCheckBox; //導入方法依賴的package包/類
@Override
public Component getListCellRendererComponent(
    JList<? extends JCheckBox> list, JCheckBox value, int index,
    boolean isSelected, boolean cellHasFocus) {
  JPanel panel = new JPanel(new BorderLayout());

  JCheckBox checkbox = value;
  final JCheckBox newCheck = new JCheckBox();
  final JLabel newLabel = new JLabel(checkbox.getText());
  newCheck.setSelected(checkbox.isSelected());
  // Drawing checkbox, change the appearance here
  newCheck.setBackground(isSelected ? getSelectionBackground()
      : getBackground());
  newCheck.setForeground(isSelected ? getSelectionForeground()
      : getForeground());
  newCheck.setEnabled(isEnabled());
  newCheck.setFont(getFont());
  newCheck.setFocusPainted(false);
  newCheck.setBorderPainted(true);
  newCheck.setBorder(isSelected ? UIManager
      .getBorder("List.focusCellHighlightBorder") : noFocusBorder);
  newLabel.setOpaque(true);
  newLabel.setBackground(isSelected ? getSelectionBackground()
      : getBackground());
  newLabel.setForeground(isSelected ? getSelectionForeground()
      : getForeground());
  newLabel.setEnabled(isEnabled());
  newLabel.setFocusable(false);
  newLabel.setFont(getFont());
  newLabel.setBorder(isSelected ? UIManager
      .getBorder("List.focusCellHighlightBorder") : noFocusBorder);
  newLabel.setIcon(checkbox.getIcon());

  panel.add(newCheck, BorderLayout.WEST);
  panel.add(newLabel, BorderLayout.CENTER);
  return panel;
}
 
開發者ID:gurkenlabs,項目名稱:litiengine,代碼行數:38,代碼來源:JCheckBoxList.java

示例3: setCheckBoxValue

import javax.swing.JCheckBox; //導入方法依賴的package包/類
private void setCheckBoxValue(Boolean value, boolean defValue, JCheckBox component) {
    if (value != null) {
        component.setSelected(value.booleanValue());
        component.setToolTipText(null);
        inherited = false;
        component.setFont(component.getFont().deriveFont(Font.BOLD));
    } else {
        component.setSelected(defValue);
        component.setToolTipText(MSG_Value_Inherited());
        inherited = true;
        component.setFont(component.getFont().deriveFont(Font.PLAIN));
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:CheckBoxUpdater.java


注:本文中的javax.swing.JCheckBox.setFont方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。