Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

visual components behavior

Posted on 1998-03-18
4
Medium Priority
?
212 Views
Last Modified: 2010-04-16
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
0
Comment
Question by:ittay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
jpk041897 earned 400 total points
ID: 1233634
Netscape send refresh messages to all elements contained in the browser area whenever the browser area gets updated, like when an immage or text is loaded and displayed, or when a part of the browser is covered by another window and redisplayed.

You need to bracket your display data using a state variable that controls which immage to display.

There is an article at:

http://www.javaworld.com/javaworld/jw-03-1997/jw-03-imagebutton.html

that contains code for a three state button in an applet that works fine on both IE and Netscape that you might want to look at.
0
 

Author Comment

by:ittay
ID: 1233635
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
0
 

Author Comment

by:ittay
ID: 1233636
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
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1233637
OK, Thanks.


0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question