Java Swt Tooltip
Hello all, I need your help on this
I have a swt tooltip being set on a label.. The tooltip method will be called setTooltip(message) will be called from a different class and the setMessage(message) will be set in the class where tooltip object will be created.. Right now Im checking for null or empty condition before setting the tooltip message otherwise it would throw IllegalArgumentException.. so my code is as such
public void setTooltip(String message) {
if (message != null && !message.isEmpty()) {
tooltip.setMessage(message);
label.addMouseTrackListener(mouseTrackListener);
iconLabel.addMouseTrackListener(mouseTrackListener);
} else {
label.removeMouseTrackListener(mouseTrackListener);
iconLabel.removeMouseTrackListener(mouseTrackListener);
}
}
I need an option in the else condition because the control goes to that line even If tooltip has not been associated with the listener.
You might be better off asking this at stackoverflow.
- Anonymous March 17, 2014