bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug swing/35901] AbstractButton.imageUpdate() always returns false.


From: freebeans at xqb dot biglobe dot ne dot jp
Subject: [Bug swing/35901] AbstractButton.imageUpdate() always returns false.
Date: 10 Apr 2008 14:24:58 -0000


------- Comment #1 from freebeans at xqb dot biglobe dot ne dot jp  2008-04-10 
14:24 -------
I'm sorry that I posted incorrect code.
Following code works correctly.
---
  public boolean imageUpdate(Image img, int infoflags, int x, int y, int w,
                             int h)
  {
    Icon i = default_icon;
    ButtonModel model = getModel();

    if (model.isPressed() && pressed_icon != null && isEnabled())
      i = pressed_icon;

    else if (model.isRollover())
      {
        if (isSelected() && rolloverSelectedIcon != null)
          i = rolloverSelectedIcon;
        else if (rolloverIcon != null)
          i = rolloverIcon;
      }    

    else if (isSelected() && isEnabled())
      {
        if (isEnabled() && selectedIcon != null)
          i = selectedIcon;
        else if (disabledSelectedIcon != null)
          i = disabledSelectedIcon;
      }

    else if (! isEnabled() && disabledIcon != null)
      i = disabledIcon;

        boolean result;
        if (! (i instanceof ImageIcon) || ((ImageIcon) i).getImage() != img) {
                result = false;
        } else {
                result = super.imageUpdate(img, infoflags, x, y, w, h);
        }
        return result;
  }
---


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35901





reply via email to

[Prev in Thread] Current Thread [Next in Thread]