Print at Dec 21, 2025, 7:52:58 PM

Posted by mikeycast at May 6, 2012, 7:08:04 PM
Attach View issue
Hello dear developpers,

I actually have an issue modifying the source code of Sweet Home. I want to create a new window with only the 3D view. I don't want to use the DetachView() function because I want to add other components in the window.

I then used the line
view3D = (JComponent)homeController.getHomeController3D().getView();

to include the view in my window.

The problem is that the 3D view gets out of the main frame of sweetHome when I do that.

When I close the window, I want the 3D view to reattach into the SweetHome main window. I tried to put this line into a listener of the second window but it doesn't work : homeController.attachView(homeController.getHomeController3D().getView());

Firstly, I don't understand why it does not work.

My next idea is to make a .validate(); .repaint(); of the HomeFramePane so I would place a listener of the second window in the HomeFramePane or HomePane class. I don't know how to do this, as long as I have the error "cannot be resolved to a type" when I do in the second window class addListener(secondWindowListener);

I thank you all by advance for your help.

Good evening,

Mikael