本文整理汇总了Java中javax.swing.event.ListDataEvent.getSource方法的典型用法代码示例。如果您正苦于以下问题:Java ListDataEvent.getSource方法的具体用法?Java ListDataEvent.getSource怎么用?Java ListDataEvent.getSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.event.ListDataEvent
的用法示例。
在下文中一共展示了ListDataEvent.getSource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
}