本文整理匯總了Java中javax.swing.event.ListDataEvent類的典型用法代碼示例。如果您正苦於以下問題:Java ListDataEvent類的具體用法?Java ListDataEvent怎麽用?Java ListDataEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ListDataEvent類屬於javax.swing.event包,在下文中一共展示了ListDataEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: callListenersRemove
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
private void callListenersRemove(ListEdit<T> edit, ListDataEvent dataEvent) {
assert (!editProtection[0]);
editProtection[0] = true;
try {
if (edit != null) {
addEdit(edit);
}
for (ListDataListener l : listDataListeners) {
l.intervalRemoved(dataEvent);
}
}
finally {
editProtection[0] = false;
}
}
示例2: callListenersSet
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
private void callListenersSet(ListEdit<T> edit, ListDataEvent dataEvent) {
assert (!editProtection[0]);
editProtection[0] = true;
try {
if (edit != null) {
addEdit(edit);
}
if (dataEvent != null) {
for (ListDataListener l : listDataListeners) {
l.contentsChanged(dataEvent);
}
}
}
finally {
editProtection[0] = false;
}
}
示例3: contentsChanged
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
public void contentsChanged(ListDataEvent e) {
if (customWidth < 0) {
if (rModel.getContent() == null) {
longestText = -1;
resultWidth = -1;
} else {
for (CategoryResult r : rModel.getContent()) {
for (ItemResult i : r.getItems()) {
int l = i.getDisplayName().length();
if (l > longestText) {
longestText = l;
resultWidth = -1;
}
}
}
}
}
updatePopup(evalTask != null);
}
示例4: fireContentsChanged
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
private void fireContentsChanged(int index) {
final ListDataListener[] clone;
synchronized (listeners) {
clone = listeners.toArray(new ListDataListener[listeners.size()]);
}
final ListDataEvent event = new ListDataEvent(
this,
ListDataEvent.CONTENTS_CHANGED,
index,
index);
for (ListDataListener listener: clone) {
listener.contentsChanged(event);
}
}
示例5: contentsChanged
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
public void contentsChanged(ListDataEvent e) {
PlatformKey selectedPlatform = (PlatformKey) platformComboBoxModel.getSelectedItem();
JavaPlatform platform = getPlatform(selectedPlatform);
if (platform != null &&
!((platformComboBoxModel instanceof PlatformComboBoxModel) && ((PlatformComboBoxModel)platformComboBoxModel).inUpdate)) {
SpecificationVersion version = platform.getSpecification().getVersion();
if (selectedSourceLevel != null
&& selectedSourceLevel.compareTo(version) > 0
&& !shouldChangePlatform(selectedSourceLevel, version)
&& !selectedPlatform.equals(activePlatform)) {
// restore original
platformComboBoxModel.setSelectedItem(activePlatform);
return;
} else {
originalSourceLevel = null;
}
}
activePlatform = selectedPlatform;
resetCache();
}
示例6: intervalAdded
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
/**
* A new time came in via the connected timer
* @param e only use the source of the list event data
*/
@Override
public void intervalAdded(ListDataEvent e)
{
// Select first item if its brand new and we aren't editing another time
TimeStorage s = (TimeStorage)e.getSource();
if ((s.getFinishedCount() == 1) && (time.getText().equals("")))
{
Component compFocusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
while (compFocusOwner != null)
{
if ((compFocusOwner instanceof TimeEntry) || (compFocusOwner instanceof RunsTable))
{
selectNext(0); // only select and pull focus if users isn't 'focused' doing something else
break;
}
compFocusOwner = compFocusOwner.getParent();
}
}
// regardless, note the last timer data as the announcer panel wants it
if (s.getFinishedCount() > 0) // should always be true but just in case
{
Messenger.sendEvent(MT.TIME_RECEIVED, s.getRun(s.getFinishedCount()-1));
}
}
示例7: resultChanged
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
@Override
public final void resultChanged(LookupEvent ev) {
List<WizardAdapter> fresh = new ArrayList<WizardAdapter>();
for (ServerWizardProvider wizard : result.allInstances()) {
// safety precaution shouldn't ever happen - used because of bridging
if (wizard.getInstantiatingIterator() != null) {
fresh.add(new WizardAdapter(wizard));
}
}
Collections.sort(fresh);
synchronized (serverWizards) {
serverWizards.clear();
serverWizards.addAll(fresh);
}
ListDataEvent event = new ListDataEvent(this,
ListDataEvent.CONTENTS_CHANGED, 0, fresh.size() - 1);
for (ListDataListener l : listeners) {
l.contentsChanged(event);
}
}
示例8: addAll
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
@Override
public boolean addAll(int index, Collection<? extends T> c) {
if (editProtection[0]) {
throw new ConcurrentModificationException();
}
list.addAll(index, c);
callListenersAdd(
new ListEdit<T>(ListEdit.Type.ADD_MULTIPLE, getMainList(), index + offset, c),
new ListDataEvent(getMainList(), ListDataEvent.INTERVAL_ADDED, index + offset, index + offset + c.size() - 1)
);
return true;
}
示例9: clear
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
@Override
public void clear() {
if (editProtection[0]) {
throw new ConcurrentModificationException();
}
Collection<T> copy = new ArrayList<T>(list);
list.clear();
callListenersRemove(
new ListEdit<T>(ListEdit.Type.REMOVE_MULTIPLE, getMainList(), offset, copy),
new ListDataEvent(getMainList(), ListDataEvent.INTERVAL_REMOVED, offset, offset + copy.size() - 1)
);
}
示例10: set
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
@Override
public T set(int index, T element) {
if (editProtection[0]) {
throw new ConcurrentModificationException();
}
T oldElement = list.set(index, element);
callListenersSet(
new ListEdit<T>(ListEdit.Type.SET, getMainList(), index + offset, oldElement, element),
new ListDataEvent(getMainList(), ListDataEvent.CONTENTS_CHANGED, index + offset, index + offset)
);
return oldElement;
}
示例11: undoAdd
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
private void undoAdd(ListEdit<T> edit) {
assert (edit.list.list.get(edit.index) == edit.item);
edit.list.list.remove(edit.index);
callListenersRemove(
null,
new ListDataEvent(edit.list, ListDataEvent.INTERVAL_REMOVED, edit.index, edit.index)
);
}
示例12: undoRemove
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
private void undoRemove(ListEdit<T> edit) {
edit.list.list.add(edit.index, edit.item);
callListenersAdd(
null,
new ListDataEvent(edit.list, ListDataEvent.INTERVAL_ADDED, edit.index, edit.index)
);
}
示例13: undoRemoveMultiple
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
private void undoRemoveMultiple(ListEdit<T> edit) {
int index = edit.index;
for (T item : edit.items) {
edit.list.list.add(index++, item);
}
callListenersAdd(
null,
new ListDataEvent(edit.list, ListDataEvent.INTERVAL_ADDED, edit.index, edit.index + edit.items.size())
);
}
示例14: redoSet
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
private void redoSet(ListEdit<T> edit) {
edit.list.list.set(edit.index, edit.item2);
callListenersSet(
null,
new ListDataEvent(edit.list, ListDataEvent.CONTENTS_CHANGED, edit.index, edit.index)
);
}
示例15: addListDataListener
import javax.swing.event.ListDataEvent; //導入依賴的package包/類
@Override
public void addListDataListener(ListDataListener l) {
if (listeners == null) {
listeners = new ArrayList<ListDataListener>(3);
event = new ListDataEvent(this, CONTENTS_CHANGED, -1, -1);
}
listeners.add(l);
}