Fixes active call button in the search field, even if not visible. Bug reported by Lubomir Marinov June 12, 2010 on dev (subject: Call button in the search field active even when not visible).

cusax-fix
Yana Stamcheva 16 years ago
parent e068d2451d
commit 7c11cae690

@ -8,7 +8,6 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import net.java.sip.communicator.util.swing.event.*;

@ -50,6 +50,11 @@ public class SearchFieldUI
private final String callString
= GuiActivator.getResources().getI18NString("service.gui.CALL");
/**
* Indicates if the call icon is currently visible.
*/
private boolean isCallIconVisible = false;
/**
* Creates a <tt>SIPCommTextFieldUI</tt>.
*/
@ -124,7 +129,11 @@ protected void customPaintBackground(Graphics g)
g2.drawImage(callRolloverIcon, dx, dy, null);
else
g2.drawImage(callIcon, dx, dy, null);
isCallIconVisible = true;
}
else
isCallIconVisible = false;
}
finally
@ -231,7 +240,7 @@ private void updateCallIcon(MouseEvent evt)
Rectangle callButtonRect = getCallButtonRect();
if (callButtonRect.contains(x, y))
if (isCallIconVisible && callButtonRect.contains(x, y))
{
JTextComponent c = getComponent();
String searchText = c.getText();

@ -53,6 +53,11 @@ public class SIPCommTextFieldUI
*/
protected SIPCommButton deleteButton;
/**
* Indicates if the delete icon is visible.
*/
private boolean isDeleteIconVisible = false;
/**
* Creates a <tt>SIPCommTextFieldUI</tt>.
*/
@ -128,6 +133,7 @@ protected void customPaintBackground(Graphics g)
int dx = deleteButtonRect.x;
int dy = deleteButtonRect.y;
if (c.getText() != null
&& c.getText().length() > 0
&& isDeleteButtonEnabled)
@ -136,7 +142,11 @@ protected void customPaintBackground(Graphics g)
g2.drawImage(deleteButtonRolloverImg, dx, dy, null);
else
g2.drawImage(deleteButtonImg, dx, dy, null);
isDeleteIconVisible = true;
}
else
isDeleteIconVisible = false;
g2.setStroke(new BasicStroke(1f));
g2.setColor(Color.GRAY);
@ -160,12 +170,13 @@ protected void updateDeleteIcon(MouseEvent evt)
{
int x = evt.getX();
int y = evt.getY();
if (!isDeleteButtonEnabled)
return;
Rectangle deleteRect = getDeleteButtonRect();
if (deleteRect.contains(x, y))
if (isDeleteIconVisible && deleteRect.contains(x, y))
{
isDeleteMouseOver = true;
getComponent().setCursor(Cursor.getDefaultCursor());

Loading…
Cancel
Save