本文整理汇总了Java中javax.swing.JToggleButton.setBorderPainted方法的典型用法代码示例。如果您正苦于以下问题:Java JToggleButton.setBorderPainted方法的具体用法?Java JToggleButton.setBorderPainted怎么用?Java JToggleButton.setBorderPainted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JToggleButton
的用法示例。
在下文中一共展示了JToggleButton.setBorderPainted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createToggle
import javax.swing.JToggleButton; //导入方法依赖的package包/类
private JToggleButton createToggle(Map<String, Boolean> fStates, int index) {
boolean isSelected = filtersDesc.isSelected(index);
boolean enabled = filtersDesc.isEnabled(index);
Icon icon = filtersDesc.getIcon(index);
// ensure small size, just for the icon
JToggleButton result = new JToggleButton(icon, enabled && isSelected);
Dimension size = new Dimension(21, 21); // 3 less than other buttons
result.setMaximumSize(size);
result.setMinimumSize(size);
result.setPreferredSize(size);
if ("Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
result.setBorderPainted(true);
} else {
result.setBorderPainted(false);
}
// result.setMargin(new Insets(2, 3, 2, 3));
result.setToolTipText(filtersDesc.getTooltip(index));
result.setEnabled(enabled);
fStates.put(filtersDesc.getKey(index), Boolean.valueOf(isSelected));
return result;
}
示例2: updateState
import javax.swing.JToggleButton; //导入方法依赖的package包/类
void updateState() {
JEditorPane pane = getPane();
if (pane != null) {
boolean rectangleSelection = RectangularSelectionUtils.isRectangularSelection(pane);
JToggleButton toggleButton = getToggleButton();
if (toggleButton != null) {
toggleButton.setSelected(rectangleSelection);
toggleButton.setContentAreaFilled(rectangleSelection);
toggleButton.setBorderPainted(rectangleSelection);
}
}
}