本文整理汇总了Java中javax.swing.JList.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java JList.isEnabled方法的具体用法?Java JList.isEnabled怎么用?Java JList.isEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JList
的用法示例。
在下文中一共展示了JList.isEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getListCellRendererComponent
import javax.swing.JList; //导入方法依赖的package包/类
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
ExclTargetEntry entry = (ExclTargetEntry)value;
setText(entry.artif.getArtifactId());
setSelected(entry.isSelected);
setEnabled(list.isEnabled());
setOpaque(isSelected && list.isEnabled());
if (isSelected && list.isEnabled()) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
} else {
setBackground(list.getBackground());
setForeground(list.getForeground());
}
return this;
}
示例2: getListCellRendererComponent
import javax.swing.JList; //导入方法依赖的package包/类
@Override
public Component getListCellRendererComponent (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (value instanceof HgLogMessage) {
HgLogMessage message = (HgLogMessage) value;
if (message == TIP || message == NO_REVISION) {
value = message.getCSetShortID();
} else {
StringBuilder sb = new StringBuilder().append(message.getRevisionNumber());
HgLogMessage parent = parentRevision;
if (parent != null && parent.getRevisionNumber().equals(message.getRevisionNumber())) {
sb.append(MARK_ACTIVE_HEAD);
}
StringBuilder labels = new StringBuilder();
for (String branch : message.getBranches()) {
labels.append(branch).append(' ');
}
for (String tag : message.getTags()) {
labels.append(tag).append(' ');
break; // just one tag
}
sb.append(" (").append(labels).append(labels.length() == 0 ? "" : "- ").append(message.getCSetShortID().substring(0, 7)).append(")"); //NOI18N
if (!message.getShortMessage().isEmpty()) {
sb.append(" - ").append(message.getShortMessage()); //NOI18N
}
value = sb.toString();
}
}
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (isSelected && !list.isEnabled() && c instanceof JLabel) {
// hack for unreadable combination: disabled, selectedForegroud, selectedBackground on dark LAF
((JLabel) c).setEnabled(true);
}
return c;
}
示例3: valueChanged
import javax.swing.JList; //导入方法依赖的package包/类
@Override
public void valueChanged(ListSelectionEvent lse) {
JList lst = (JList)lse.getSource();
boolean sel = lst.isEnabled() && !lst.isSelectionEmpty();
btnRemoveGeneric.setEnabled(sel);
}