重写getPreferredAction()方法即可
public class UserNode extends AbstractNode {
public UserNode(PeerInfo peerInfo) {
super(Children.LEAF, Lookups.singleton(peerInfo));
this.setName(peerInfo.getPeerID());
this.setDisplayName(peerInfo.getName());
}
@Override
public Action[] getActions (boolean popup) {
return new Action[] {new ChatAction()};
}
@Override
public Action getPreferredAction() {
return new ChatAction();
}
}
public UserNode(PeerInfo peerInfo) {
super(Children.LEAF, Lookups.singleton(peerInfo));
this.setName(peerInfo.getPeerID());
this.setDisplayName(peerInfo.getName());
}
@Override
public Action[] getActions (boolean popup) {
return new Action[] {new ChatAction()};
}
@Override
public Action getPreferredAction() {
return new ChatAction();
}
}
——————————————————————————————————
傲轩游戏网
傲轩游戏网