本文整理匯總了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);
}