Link to home
Start Free TrialLog in
Avatar of SStory
SStoryFlag for United States of America

asked on

Responding to Java JComponent extended classes's resize event

I created a component that extends JComponent. In the form designer, when it is resized, I need to perform some actions..in this case increasing the diameter of a meter I am drawing.  What do I do to respond to the resize event inside that component during design time and runtime?
Avatar of CPColin
CPColin
Flag of United States of America image

Try overriding Component.validate(). It should be called every time the component is resized. Alternatively, you could always calculate the dimension of the meter based on the current size of the component. That way, you can be sure it's correct, every time the component is painted. (It's been a while since I've done stuff with Swing, though.)
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

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 SStory

ASKER

I had already been trying, but apparently had some bad code.  Also, had to close my the file and recompile..apparently.  It seems to be working now.
:)