I think the original check was an incorrect phrasing of "if one is
null and the other is non-null or if they're both non-null and
logically different".

-T

On Tue, May 26, 2009 at 9:46 AM, Christopher Brind <[email protected]> wrote:
> What if previousTitle is null?
>
> Though it will fire the listeners unnecessarily (if the titles are the same
> text just with a different reference) Greg's version is safer.
>
> Cheers,
> Chris
>
>
> 2009/5/26 Edgar Merino <[email protected]>
>
>> Ok, just a little change there:
>>
>>   if (!previousTitle.equals(title)) { ... }
>>
>> Edgar Merino
>>
>>
>>
>> Greg Brown escribió:
>>
>>  Good catch. There's no reason we need the XOR. I changed it to this:
>>>
>>>        String previousTitle = this.title;
>>>
>>>        if (previousTitle != title) {
>>>            this.title = title;
>>>            windowListeners.titleChanged(this, previousTitle);
>>>        }
>>>
>>> Thanks,
>>> Greg
>>>  On Tuesday, May 26, 2009, at 02:37AM, "Edgar Merino" <[email protected]>
>>> wrote:
>>>
>>>
>>>> Hello,
>>>>
>>>>   By looking through the Window source code, I've noticed the setTitle()
>>>> method has this restriction:
>>>>
>>>>   String previousTitle = this.title;
>>>>
>>>>   if (previousTitle == null ^ title == null) {
>>>>       this.title = title;
>>>>       windowListeners.titleChanged(this, previousTitle);
>>>>   }
>>>>
>>>>   This is keeping the windows in my application to not be able to change
>>>> their title once it's been set for the first time. Why is that restriction
>>>> there? I've removed the restriction and changed it to only check if the new
>>>> title is not null, so far I haven't encountered any problems, but there
>>>> might be some explanation as to why it's there.
>>>>
>>>> Edgar Merino
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>

Reply via email to