[jitsi-dev] Fwd: [jitsi~svn:10608] Fixes SipCommButtons so that only one of bgImage/rolloverImage/pressedIma


#1

Hey Tom,

Unfortunately this commit breaks the look of buttons in the contact list. When you make a rollover on any of the buttons of a selected contact the background image is cut and shouldn't be. Could you please have a look?

Cheers,
Yana

···

Begin forwarded message:

From: tomdenham@java.net
Subject: [jitsi~svn:10608] Fixes SipCommButtons so that only one of bgImage/rolloverImage/pressedIma
Date: March 15, 2013 12:52:30 PM GMT+01:00
To: commits@jitsi.java.net
Reply-To: commits@jitsi.java.net

Project: jitsi
Repository: svn
Revision: 10608
Author: tomdenham
Date: 2013-03-15 11:52:29 UTC
Link:

Log Message:
------------
Fixes SipCommButtons so that only one of bgImage/rolloverImage/pressedImage is painted, with only one of iconImage/rolloverIconImage/pressedIconImage painted over the top, with the correct alignment.

Previously, when an enabled SipCommButton was painted, the layers were (from the bottom layer upwards):
1) bgImage (centre aligned)
2) rolloverImage* or pressedImage, as appropriate (top-left aligned)
3) iconImage or rolloverIconImage or pressedIconImage, using iconImage if a special-state image is required but not available (centre aligned)

*The javadoc for setRolloverImage says that it's rolloverImage is the 'rollover background image', just as bgImage is the 'background image'

Now, the layers will be:
1) bgImage or rolloverBgImage or pressedBgImage, using bgImage if a special-state image is required but not available (centre aligned)
2) iconImage or rolloverIconImage or pressedIconImage, using iconImage if a special-state image is required but not available (centre aligned)

We had hit the issue that when using three different images (not icons) for a SipCommButton, the default image would show through any translucent areas of a pressed/rollover image

Revisions:
----------
10608

Modified Paths:
---------------
trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java

Diffs:
------
Index: trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java

--- trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java (revision 10607)
+++ trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java (revision 10608)
@@ -31,9 +31,9 @@

    private Image bgImage;

- private Image pressedImage;
+ private Image pressedBgImage;

- private Image rolloverImage;
+ private Image rolloverBgImage;

    private Image rolloverIconImage;

@@ -84,8 +84,8 @@
        this.setBorder(null);

        this.bgImage = bgImage;
- this.rolloverImage = rolloverImage;
- this.pressedImage = pressedImage;
+ this.rolloverBgImage = rolloverImage;
+ this.pressedBgImage = pressedImage;
        this.rolloverIconImage = rolloverIconImage;
        this.pressedIconImage = pressedIconImage;
        this.iconImage = iconImage;
@@ -187,11 +187,20 @@
            g.fillRect(0, 0, getWidth(), getHeight());
        }

- if (this.bgImage != null)
+ // Paint pressed state.
+ Image paintBgImage = null;
+ if (this.getModel().isPressed() && this.pressedBgImage != null)
        {
+ paintBgImage = this.pressedBgImage;
+ }
+ else if (this.getModel().isRollover() && this.rolloverBgImage != null)
+ {
+ paintBgImage = this.rolloverBgImage;
+ }
+ else if (this.bgImage != null)
+ {
            // If there's no icon, we make grey the backgroundImage
            // when disabled.
- Image paintBgImage;
            if (this.iconImage == null && !isEnabled())
            {
                paintBgImage = new ImageIcon(LightGrayFilter
@@ -199,7 +208,10 @@
            }
            else
                paintBgImage = bgImage;
+ }

+ if (paintBgImage != null)
+ {
            g.drawImage(paintBgImage,
                        this.getWidth()/2 - paintBgImage.getWidth(null)/2,
                        this.getHeight()/2 - paintBgImage.getHeight(null)/2,
@@ -207,7 +219,7 @@
        }

        // Paint a roll over fade out.
- if (rolloverImage == null)
+ if (rolloverBgImage == null)
        {
            FadeTracker fadeTracker = FadeTracker.getInstance();

@@ -229,16 +241,6 @@
            }
        }

- // Paint pressed state.
- if (this.getModel().isPressed() && this.pressedImage != null)
- {
- g.drawImage(this.pressedImage, 0, 0, this);
- }
- else if (this.getModel().isRollover() && this.rolloverImage != null)
- {
- g.drawImage(this.rolloverImage, 0, 0, this);
- }
-
        Image paintIconImage = null;
        if (getModel().isPressed() && pressedIconImage != null)
        {
@@ -301,17 +303,17 @@
     */
    public void setRolloverImage(Image rolloverImage)
    {
- this.rolloverImage = rolloverImage;
+ this.rolloverBgImage = rolloverImage;
    }

    /**
- * Sets the pressed image of this button.
+ * Sets the pressed background image of this button.
     *
- * @param pressedImage the pressed image of this button.
+ * @param pressedImage the pressed background image of this button.
     */
    public void setPressedImage(Image pressedImage)
    {
- this.pressedImage = pressedImage;
+ this.pressedBgImage = pressedImage;
    }

    /**


#2

Sure, I'll take a look.

Tom

···

-----Original Message-----

From: Yana Stamcheva [mailto:yana@jitsi.org]

Sent: 20 March 2013 13:39
To: dev@jitsi.java.net
Subject: [jitsi-dev] Fwd: [jitsi~svn:10608] Fixes SipCommButtons so that only one of bgImage/rolloverImage/pressedIma

Hey Tom,

Unfortunately this commit breaks the look of buttons in the contact list. When you make a rollover on any of the buttons of a selected contact the background image is cut and shouldn't be. Could you please have a look?

Cheers,
Yana

Begin forwarded message:

From: tomdenham@java.net
Subject: [jitsi~svn:10608] Fixes SipCommButtons so that only one of
bgImage/rolloverImage/pressedIma
Date: March 15, 2013 12:52:30 PM GMT+01:00
To: commits@jitsi.java.net
Reply-To: commits@jitsi.java.net

Project: jitsi
Repository: svn
Revision: 10608
Author: tomdenham
Date: 2013-03-15 11:52:29 UTC
Link:

Log Message:
------------
Fixes SipCommButtons so that only one of bgImage/rolloverImage/pressedImage is painted, with only one of iconImage/rolloverIconImage/pressedIconImage painted over the top, with the correct alignment.

Previously, when an enabled SipCommButton was painted, the layers were (from the bottom layer upwards):
1) bgImage (centre aligned)
2) rolloverImage* or pressedImage, as appropriate (top-left aligned)
3) iconImage or rolloverIconImage or pressedIconImage, using iconImage if a special-state image is required but not available (centre aligned)

*The javadoc for setRolloverImage says that it's rolloverImage is the 'rollover background image', just as bgImage is the 'background image'

Now, the layers will be:
1) bgImage or rolloverBgImage or pressedBgImage, using bgImage if a special-state image is required but not available (centre aligned)
2) iconImage or rolloverIconImage or pressedIconImage, using iconImage if a special-state image is required but not available (centre aligned)

We had hit the issue that when using three different images (not
icons) for a SipCommButton, the default image would show through any
translucent areas of a pressed/rollover image

Revisions:
----------
10608

Modified Paths:
---------------
trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.j
ava

Diffs:
------
Index:
trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.j
ava

--- trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java (revision 10607)
+++ trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java (revision 10608)
@@ -31,9 +31,9 @@

    private Image bgImage;

- private Image pressedImage;
+ private Image pressedBgImage;

- private Image rolloverImage;
+ private Image rolloverBgImage;

    private Image rolloverIconImage;

@@ -84,8 +84,8 @@
        this.setBorder(null);

        this.bgImage = bgImage;
- this.rolloverImage = rolloverImage;
- this.pressedImage = pressedImage;
+ this.rolloverBgImage = rolloverImage;
+ this.pressedBgImage = pressedImage;
        this.rolloverIconImage = rolloverIconImage;
        this.pressedIconImage = pressedIconImage;
        this.iconImage = iconImage;
@@ -187,11 +187,20 @@
            g.fillRect(0, 0, getWidth(), getHeight());
        }

- if (this.bgImage != null)
+ // Paint pressed state.
+ Image paintBgImage = null;
+ if (this.getModel().isPressed() && this.pressedBgImage !=
+ null)
        {
+ paintBgImage = this.pressedBgImage;
+ }
+ else if (this.getModel().isRollover() && this.rolloverBgImage != null)
+ {
+ paintBgImage = this.rolloverBgImage;
+ }
+ else if (this.bgImage != null)
+ {
            // If there's no icon, we make grey the backgroundImage
            // when disabled.
- Image paintBgImage;
            if (this.iconImage == null && !isEnabled())
            {
                paintBgImage = new ImageIcon(LightGrayFilter @@ -199,7
+208,10 @@
            }
            else
                paintBgImage = bgImage;
+ }

+ if (paintBgImage != null)
+ {
            g.drawImage(paintBgImage,
                        this.getWidth()/2 - paintBgImage.getWidth(null)/2,
                        this.getHeight()/2 -
paintBgImage.getHeight(null)/2, @@ -207,7 +219,7 @@
        }

        // Paint a roll over fade out.
- if (rolloverImage == null)
+ if (rolloverBgImage == null)
        {
            FadeTracker fadeTracker = FadeTracker.getInstance();

@@ -229,16 +241,6 @@
            }
        }

- // Paint pressed state.
- if (this.getModel().isPressed() && this.pressedImage != null)
- {
- g.drawImage(this.pressedImage, 0, 0, this);
- }
- else if (this.getModel().isRollover() && this.rolloverImage != null)
- {
- g.drawImage(this.rolloverImage, 0, 0, this);
- }
-
        Image paintIconImage = null;
        if (getModel().isPressed() && pressedIconImage != null)
        {
@@ -301,17 +303,17 @@
     */
    public void setRolloverImage(Image rolloverImage)
    {
- this.rolloverImage = rolloverImage;
+ this.rolloverBgImage = rolloverImage;
    }

    /**
- * Sets the pressed image of this button.
+ * Sets the pressed background image of this button.
     *
- * @param pressedImage the pressed image of this button.
+ * @param pressedImage the pressed background image of this button.
     */
    public void setPressedImage(Image pressedImage)
    {
- this.pressedImage = pressedImage;
+ this.pressedBgImage = pressedImage;
    }

    /**


#3

Hey Tom,

Sure, I'll take a look.

Thanks!

Do you think you'll have the time to look at it tomorrow or you prefer that we revert it for the time being and then you commit again when you're ready?

Cheers,
Yana

···

On Mar 20, 2013, at 4:17 PM, Tom Denham <Tom.Denham@metaswitch.com> wrote:

Tom

-----Original Message-----
From: Yana Stamcheva [mailto:yana@jitsi.org]
Sent: 20 March 2013 13:39
To: dev@jitsi.java.net
Subject: [jitsi-dev] Fwd: [jitsi~svn:10608] Fixes SipCommButtons so that only one of bgImage/rolloverImage/pressedIma

Hey Tom,

Unfortunately this commit breaks the look of buttons in the contact list. When you make a rollover on any of the buttons of a selected contact the background image is cut and shouldn't be. Could you please have a look?

Cheers,
Yana

Begin forwarded message:

From: tomdenham@java.net
Subject: [jitsi~svn:10608] Fixes SipCommButtons so that only one of
bgImage/rolloverImage/pressedIma
Date: March 15, 2013 12:52:30 PM GMT+01:00
To: commits@jitsi.java.net
Reply-To: commits@jitsi.java.net

Project: jitsi
Repository: svn
Revision: 10608
Author: tomdenham
Date: 2013-03-15 11:52:29 UTC
Link:

Log Message:
------------
Fixes SipCommButtons so that only one of bgImage/rolloverImage/pressedImage is painted, with only one of iconImage/rolloverIconImage/pressedIconImage painted over the top, with the correct alignment.

Previously, when an enabled SipCommButton was painted, the layers were (from the bottom layer upwards):
1) bgImage (centre aligned)
2) rolloverImage* or pressedImage, as appropriate (top-left aligned)
3) iconImage or rolloverIconImage or pressedIconImage, using iconImage if a special-state image is required but not available (centre aligned)

*The javadoc for setRolloverImage says that it's rolloverImage is the 'rollover background image', just as bgImage is the 'background image'

Now, the layers will be:
1) bgImage or rolloverBgImage or pressedBgImage, using bgImage if a special-state image is required but not available (centre aligned)
2) iconImage or rolloverIconImage or pressedIconImage, using iconImage if a special-state image is required but not available (centre aligned)

We had hit the issue that when using three different images (not
icons) for a SipCommButton, the default image would show through any
translucent areas of a pressed/rollover image

Revisions:
----------
10608

Modified Paths:
---------------
trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.j
ava

Diffs:
------
Index:
trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.j
ava

--- trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java (revision 10607)
+++ trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java (revision 10608)
@@ -31,9 +31,9 @@

   private Image bgImage;

- private Image pressedImage;
+ private Image pressedBgImage;

- private Image rolloverImage;
+ private Image rolloverBgImage;

   private Image rolloverIconImage;

@@ -84,8 +84,8 @@
       this.setBorder(null);

       this.bgImage = bgImage;
- this.rolloverImage = rolloverImage;
- this.pressedImage = pressedImage;
+ this.rolloverBgImage = rolloverImage;
+ this.pressedBgImage = pressedImage;
       this.rolloverIconImage = rolloverIconImage;
       this.pressedIconImage = pressedIconImage;
       this.iconImage = iconImage;
@@ -187,11 +187,20 @@
           g.fillRect(0, 0, getWidth(), getHeight());
       }

- if (this.bgImage != null)
+ // Paint pressed state.
+ Image paintBgImage = null;
+ if (this.getModel().isPressed() && this.pressedBgImage !=
+ null)
       {
+ paintBgImage = this.pressedBgImage;
+ }
+ else if (this.getModel().isRollover() && this.rolloverBgImage != null)
+ {
+ paintBgImage = this.rolloverBgImage;
+ }
+ else if (this.bgImage != null)
+ {
           // If there's no icon, we make grey the backgroundImage
           // when disabled.
- Image paintBgImage;
           if (this.iconImage == null && !isEnabled())
           {
               paintBgImage = new ImageIcon(LightGrayFilter @@ -199,7
+208,10 @@
           }
           else
               paintBgImage = bgImage;
+ }

+ if (paintBgImage != null)
+ {
           g.drawImage(paintBgImage,
                       this.getWidth()/2 - paintBgImage.getWidth(null)/2,
                       this.getHeight()/2 -
paintBgImage.getHeight(null)/2, @@ -207,7 +219,7 @@
       }

       // Paint a roll over fade out.
- if (rolloverImage == null)
+ if (rolloverBgImage == null)
       {
           FadeTracker fadeTracker = FadeTracker.getInstance();

@@ -229,16 +241,6 @@
           }
       }

- // Paint pressed state.
- if (this.getModel().isPressed() && this.pressedImage != null)
- {
- g.drawImage(this.pressedImage, 0, 0, this);
- }
- else if (this.getModel().isRollover() && this.rolloverImage != null)
- {
- g.drawImage(this.rolloverImage, 0, 0, this);
- }
-
       Image paintIconImage = null;
       if (getModel().isPressed() && pressedIconImage != null)
       {
@@ -301,17 +303,17 @@
    */
   public void setRolloverImage(Image rolloverImage)
   {
- this.rolloverImage = rolloverImage;
+ this.rolloverBgImage = rolloverImage;
   }

   /**
- * Sets the pressed image of this button.
+ * Sets the pressed background image of this button.
    *
- * @param pressedImage the pressed image of this button.
+ * @param pressedImage the pressed background image of this button.
    */
   public void setPressedImage(Image pressedImage)
   {
- this.pressedImage = pressedImage;
+ this.pressedBgImage = pressedImage;
   }

   /**


#4

I'm just looking at it at the moment, I'll try to get it fixed for backed out by lunchtime.

···

-----Original Message-----

From: Yana Stamcheva [mailto:yana@jitsi.org]

Sent: 21 March 2013 17:24
To: dev@jitsi.java.net
Subject: [jitsi-dev] Re: [jitsi~svn:10608] Fixes SipCommButtons so that only one of bgImage/rolloverImage/pressedIma

Hey Tom,

On Mar 20, 2013, at 4:17 PM, Tom Denham <Tom.Denham@metaswitch.com> wrote:

Sure, I'll take a look.

Thanks!

Do you think you'll have the time to look at it tomorrow or you prefer that we revert it for the time being and then you commit again when you're ready?

Cheers,
Yana

Tom

-----Original Message-----
From: Yana Stamcheva [mailto:yana@jitsi.org]
Sent: 20 March 2013 13:39
To: dev@jitsi.java.net
Subject: [jitsi-dev] Fwd: [jitsi~svn:10608] Fixes SipCommButtons so
that only one of bgImage/rolloverImage/pressedIma

Hey Tom,

Unfortunately this commit breaks the look of buttons in the contact list. When you make a rollover on any of the buttons of a selected contact the background image is cut and shouldn't be. Could you please have a look?

Cheers,
Yana

Begin forwarded message:

From: tomdenham@java.net
Subject: [jitsi~svn:10608] Fixes SipCommButtons so that only one of
bgImage/rolloverImage/pressedIma
Date: March 15, 2013 12:52:30 PM GMT+01:00
To: commits@jitsi.java.net
Reply-To: commits@jitsi.java.net

Project: jitsi
Repository: svn
Revision: 10608
Author: tomdenham
Date: 2013-03-15 11:52:29 UTC
Link:

Log Message:
------------
Fixes SipCommButtons so that only one of bgImage/rolloverImage/pressedImage is painted, with only one of iconImage/rolloverIconImage/pressedIconImage painted over the top, with the correct alignment.

Previously, when an enabled SipCommButton was painted, the layers were (from the bottom layer upwards):
1) bgImage (centre aligned)
2) rolloverImage* or pressedImage, as appropriate (top-left aligned)
3) iconImage or rolloverIconImage or pressedIconImage, using iconImage if a special-state image is required but not available (centre aligned)

*The javadoc for setRolloverImage says that it's rolloverImage is the 'rollover background image', just as bgImage is the 'background image'

Now, the layers will be:
1) bgImage or rolloverBgImage or pressedBgImage, using bgImage if a special-state image is required but not available (centre aligned)
2) iconImage or rolloverIconImage or pressedIconImage, using iconImage if a special-state image is required but not available (centre aligned)

We had hit the issue that when using three different images (not
icons) for a SipCommButton, the default image would show through any
translucent areas of a pressed/rollover image

Revisions:
----------
10608

Modified Paths:
---------------
trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.
j
ava

Diffs:
------
Index:
trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.
j
ava

--- trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java (revision 10607)
+++ trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java (revision 10608)
@@ -31,9 +31,9 @@

   private Image bgImage;

- private Image pressedImage;
+ private Image pressedBgImage;

- private Image rolloverImage;
+ private Image rolloverBgImage;

   private Image rolloverIconImage;

@@ -84,8 +84,8 @@
       this.setBorder(null);

       this.bgImage = bgImage;
- this.rolloverImage = rolloverImage;
- this.pressedImage = pressedImage;
+ this.rolloverBgImage = rolloverImage;
+ this.pressedBgImage = pressedImage;
       this.rolloverIconImage = rolloverIconImage;
       this.pressedIconImage = pressedIconImage;
       this.iconImage = iconImage;
@@ -187,11 +187,20 @@
           g.fillRect(0, 0, getWidth(), getHeight());
       }

- if (this.bgImage != null)
+ // Paint pressed state.
+ Image paintBgImage = null;
+ if (this.getModel().isPressed() && this.pressedBgImage !=
+ null)
       {
+ paintBgImage = this.pressedBgImage;
+ }
+ else if (this.getModel().isRollover() && this.rolloverBgImage != null)
+ {
+ paintBgImage = this.rolloverBgImage;
+ }
+ else if (this.bgImage != null)
+ {
           // If there's no icon, we make grey the backgroundImage
           // when disabled.
- Image paintBgImage;
           if (this.iconImage == null && !isEnabled())
           {
               paintBgImage = new ImageIcon(LightGrayFilter @@ -199,7
+208,10 @@
           }
           else
               paintBgImage = bgImage;
+ }

+ if (paintBgImage != null)
+ {
           g.drawImage(paintBgImage,
                       this.getWidth()/2 - paintBgImage.getWidth(null)/2,
                       this.getHeight()/2 -
paintBgImage.getHeight(null)/2, @@ -207,7 +219,7 @@
       }

       // Paint a roll over fade out.
- if (rolloverImage == null)
+ if (rolloverBgImage == null)
       {
           FadeTracker fadeTracker = FadeTracker.getInstance();

@@ -229,16 +241,6 @@
           }
       }

- // Paint pressed state.
- if (this.getModel().isPressed() && this.pressedImage != null)
- {
- g.drawImage(this.pressedImage, 0, 0, this);
- }
- else if (this.getModel().isRollover() && this.rolloverImage != null)
- {
- g.drawImage(this.rolloverImage, 0, 0, this);
- }
-
       Image paintIconImage = null;
       if (getModel().isPressed() && pressedIconImage != null)
       {
@@ -301,17 +303,17 @@
    */
   public void setRolloverImage(Image rolloverImage)
   {
- this.rolloverImage = rolloverImage;
+ this.rolloverBgImage = rolloverImage;
   }

   /**
- * Sets the pressed image of this button.
+ * Sets the pressed background image of this button.
    *
- * @param pressedImage the pressed image of this button.
+ * @param pressedImage the pressed background image of this button.
    */
   public void setPressedImage(Image pressedImage)
   {
- this.pressedImage = pressedImage;
+ this.pressedBgImage = pressedImage;
   }

   /**


#5

Hey Tom,

I'm just looking at it at the moment, I'll try to get it fixed for backed out by lunchtime.

It works now. Thanks!

Cheers,
Yana

···

On Mar 22, 2013, at 10:52 AM, Tom Denham <Tom.Denham@metaswitch.com> wrote:

-----Original Message-----
From: Yana Stamcheva [mailto:yana@jitsi.org]
Sent: 21 March 2013 17:24
To: dev@jitsi.java.net
Subject: [jitsi-dev] Re: [jitsi~svn:10608] Fixes SipCommButtons so that only one of bgImage/rolloverImage/pressedIma

Hey Tom,

On Mar 20, 2013, at 4:17 PM, Tom Denham <Tom.Denham@metaswitch.com> wrote:

Sure, I'll take a look.

Thanks!

Do you think you'll have the time to look at it tomorrow or you prefer that we revert it for the time being and then you commit again when you're ready?

Cheers,
Yana

Tom

-----Original Message-----
From: Yana Stamcheva [mailto:yana@jitsi.org]
Sent: 20 March 2013 13:39
To: dev@jitsi.java.net
Subject: [jitsi-dev] Fwd: [jitsi~svn:10608] Fixes SipCommButtons so
that only one of bgImage/rolloverImage/pressedIma

Hey Tom,

Unfortunately this commit breaks the look of buttons in the contact list. When you make a rollover on any of the buttons of a selected contact the background image is cut and shouldn't be. Could you please have a look?

Cheers,
Yana

Begin forwarded message:

From: tomdenham@java.net
Subject: [jitsi~svn:10608] Fixes SipCommButtons so that only one of
bgImage/rolloverImage/pressedIma
Date: March 15, 2013 12:52:30 PM GMT+01:00
To: commits@jitsi.java.net
Reply-To: commits@jitsi.java.net

Project: jitsi
Repository: svn
Revision: 10608
Author: tomdenham
Date: 2013-03-15 11:52:29 UTC
Link:

Log Message:
------------
Fixes SipCommButtons so that only one of bgImage/rolloverImage/pressedImage is painted, with only one of iconImage/rolloverIconImage/pressedIconImage painted over the top, with the correct alignment.

Previously, when an enabled SipCommButton was painted, the layers were (from the bottom layer upwards):
1) bgImage (centre aligned)
2) rolloverImage* or pressedImage, as appropriate (top-left aligned)
3) iconImage or rolloverIconImage or pressedIconImage, using iconImage if a special-state image is required but not available (centre aligned)

*The javadoc for setRolloverImage says that it's rolloverImage is the 'rollover background image', just as bgImage is the 'background image'

Now, the layers will be:
1) bgImage or rolloverBgImage or pressedBgImage, using bgImage if a special-state image is required but not available (centre aligned)
2) iconImage or rolloverIconImage or pressedIconImage, using iconImage if a special-state image is required but not available (centre aligned)

We had hit the issue that when using three different images (not
icons) for a SipCommButton, the default image would show through any
translucent areas of a pressed/rollover image

Revisions:
----------
10608

Modified Paths:
---------------
trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.
j
ava

Diffs:
------
Index:
trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.
j
ava

--- trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java (revision 10607)
+++ trunk/src/net/java/sip/communicator/plugin/desktoputil/SIPCommButton.java (revision 10608)
@@ -31,9 +31,9 @@

  private Image bgImage;

- private Image pressedImage;
+ private Image pressedBgImage;

- private Image rolloverImage;
+ private Image rolloverBgImage;

  private Image rolloverIconImage;

@@ -84,8 +84,8 @@
      this.setBorder(null);

      this.bgImage = bgImage;
- this.rolloverImage = rolloverImage;
- this.pressedImage = pressedImage;
+ this.rolloverBgImage = rolloverImage;
+ this.pressedBgImage = pressedImage;
      this.rolloverIconImage = rolloverIconImage;
      this.pressedIconImage = pressedIconImage;
      this.iconImage = iconImage;
@@ -187,11 +187,20 @@
          g.fillRect(0, 0, getWidth(), getHeight());
      }

- if (this.bgImage != null)
+ // Paint pressed state.
+ Image paintBgImage = null;
+ if (this.getModel().isPressed() && this.pressedBgImage !=
+ null)
      {
+ paintBgImage = this.pressedBgImage;
+ }
+ else if (this.getModel().isRollover() && this.rolloverBgImage != null)
+ {
+ paintBgImage = this.rolloverBgImage;
+ }
+ else if (this.bgImage != null)
+ {
          // If there's no icon, we make grey the backgroundImage
          // when disabled.
- Image paintBgImage;
          if (this.iconImage == null && !isEnabled())
          {
              paintBgImage = new ImageIcon(LightGrayFilter @@ -199,7
+208,10 @@
          }
          else
              paintBgImage = bgImage;
+ }

+ if (paintBgImage != null)
+ {
          g.drawImage(paintBgImage,
                      this.getWidth()/2 - paintBgImage.getWidth(null)/2,
                      this.getHeight()/2 -
paintBgImage.getHeight(null)/2, @@ -207,7 +219,7 @@
      }

      // Paint a roll over fade out.
- if (rolloverImage == null)
+ if (rolloverBgImage == null)
      {
          FadeTracker fadeTracker = FadeTracker.getInstance();

@@ -229,16 +241,6 @@
          }
      }

- // Paint pressed state.
- if (this.getModel().isPressed() && this.pressedImage != null)
- {
- g.drawImage(this.pressedImage, 0, 0, this);
- }
- else if (this.getModel().isRollover() && this.rolloverImage != null)
- {
- g.drawImage(this.rolloverImage, 0, 0, this);
- }
-
      Image paintIconImage = null;
      if (getModel().isPressed() && pressedIconImage != null)
      {
@@ -301,17 +303,17 @@
   */
  public void setRolloverImage(Image rolloverImage)
  {
- this.rolloverImage = rolloverImage;
+ this.rolloverBgImage = rolloverImage;
  }

  /**
- * Sets the pressed image of this button.
+ * Sets the pressed background image of this button.
   *
- * @param pressedImage the pressed image of this button.
+ * @param pressedImage the pressed background image of this button.
   */
  public void setPressedImage(Image pressedImage)
  {
- this.pressedImage = pressedImage;
+ this.pressedBgImage = pressedImage;
  }

  /**