Repaint Objects when Component is resized

Hi all and a happy new year to all developpers :wink:

I’m making a Chart based on AbstractVisionComponent for Client/Designer.
I just want to make the Chart getting the whole space of the component.
I use the getWidth and getHeigth methods of the AbstractVisionComponent, but I can’t get the event.

Can anyone help ?
Do I have to make a ChangeListener for these properties ?

Thanks for help.

I’ve use the following code in an AbstractVisionComponent which contains other components, to resize the sub-components according to the main :

	import java.awt.event.ComponentListener;
	Add to the constructor :
	ComponentEventListener cl = new ComponentEventListener();
	Add this subclasse in the class which extends AbstractVisionComponent :
	public class ComponentEventListener implements ComponentListener {
		public void componentHidden(ComponentEvent e) {

		public void componentMoved(ComponentEvent e) {

		public void componentResized(ComponentEvent e) {
			// resize your subcomponent here...
			canvas.setSize(getWidth(), getHeight());
			panel.setSize(getWidth(), getHeight());

		public void componentShown(ComponentEvent e) {

hope this helps !

Exactly what I needed !
Oh yes it helps :laughing:

I’ll try it as soon as possible.
Thanks !