本文整理匯總了Java中chatty.gui.UserListener類的典型用法代碼示例。如果您正苦於以下問題:Java UserListener類的具體用法?Java UserListener怎麽用?Java UserListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
UserListener類屬於chatty.gui包,在下文中一共展示了UserListener類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mousePressed
import chatty.gui.UserListener; //導入依賴的package包/類
/**
* Handles mouse presses. This is favourable to mouseClicked because it
* might work better in a fast moving chat and you won't select text
* instead of opening userinfo etc.
*
* @param e
*/
@Override
public void mousePressed(MouseEvent e) {
if (e.getClickCount() == 1 && e.getButton() == MouseEvent.BUTTON1) {
String url = getUrl(e);
if (url != null && !isUrlDeleted(e)) {
if (linkListener != null) {
linkListener.linkClicked(url);
}
return;
}
User user = getUser(e);
if (user != null) {
for (UserListener listener : userListener) {
listener.userClicked(user, e);
}
return;
}
}
else if (e.isPopupTrigger()) {
openContextMenu(e);
}
}
示例2: addUserListener
import chatty.gui.UserListener; //導入依賴的package包/類
/**
* Set the object that should receive the User object once a User is clicked
*
* @param listener
*/
public void addUserListener(UserListener listener) {
if (listener != null) {
userListener.add(listener);
}
}
示例3: setUserListener
import chatty.gui.UserListener; //導入依賴的package包/類
/**
* Set the object that should receive the User object once a User is clicked
*
* @param listener
*/
public void setUserListener(UserListener listener) {
userListener = listener;
}