本文整理汇总了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);
}
示例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;
}
示例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));
}
}