Link to home
Start Free TrialLog in
Avatar of ittay
ittay

asked on

visual components behavior

hi,

i derived a button from a button component to add a feature of being "stuck" (not raising after the user released the mouse button).
all i do is override the paint method (and update) and changing the state of the button to 'pressed' before calling super.paint(g) (for as long as i need it to remain pressed).

this works well in appletviewer.

on netscape on the other hand there is this weird fenomena: i press the button, release the mouse button, move to another place (in the applet space), then the button suddenly 'decides' to raise itself. but, if i take another window (in the win95 environment, not a jave window) and move it on the button (cover it) and then move it back the button paints itself as pressed again (with out any events in the applet).  

so i did 2 things:
a. i added System.err.println commands to show the state of the button before it paints (i see this in the java console of netcape) and indeed it stil has the press state.
b. i copied the entire paint code to my method (without call to super.paint(g)). the code seems to work ok (and it does under appletviewer), but in netscape....

so have any ideas on the subject?

thanks,
ittay
ASKER CERTIFIED SOLUTION
Avatar of jpk041897
jpk041897

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ittay
ittay

ASKER

to jpk:
i derived from a button which has this state variable. the problem was that it automaticaly sets it to unselect on various events. i tried overriding the paint method and resetting it before calling super.paint(g). that didn't help (neither doing that in update). i think this is because the component uses various item painters and view managers which don't paint it right away but query its state variable after a while (giving it a chance to undo my setting). what i finally did is to override all the processXXXX methods which changed the state and reset it after calling super.process...

since you helped me so much until now, i've accepted your answer :)
ittay
Avatar of ittay

ASKER

to jpk:
i derived from a button which has this state variable. the problem was that it automaticaly sets it to unselect on various events. i tried overriding the paint method and resetting it before calling super.paint(g). that didn't help (neither doing that in update). i think this is because the component uses various item painters and view managers which don't paint it right away but query its state variable after a while (giving it a chance to undo my setting). what i finally did is to override all the processXXXX methods which changed the state and reset it after calling super.process...

since you helped me so much until now, i've accepted your answer :)
ittay
OK, Thanks.