window is still not close...?

Hi ,
when i close a window it was closing at that time but when i open another window …previous window is also coming in back of open window…

else if (strSelectedItem.equalsIgnoreCase(“process timeline report”)) {
final Window w = new Window(“Process timeline report Help”);
VerticalLayout v = new VerticalLayout();
v.setMargin(true);
v.setSpacing(true);
w.setModal(false);
w.setContent(v);
w.setWidth(“300px”);
w.addStyleName(“notifications”);
w.setClosable(true);
w.setResizable(false);
w.setDraggable(false);
w.setPositionX(event.getClientX() - event.getRelativeX());
w.setPositionY(event.getClientY() - event.getRelativeY());
w.setCloseShortcut(KeyCode.ESCAPE, null);
StringBuilder text = new StringBuilder();
text.append( “

This set of panels asks you a couple dozen questions. From those questions AcmeCoach will build a complete document.

\n” );
Label label = new Label();
label.setStyleName( “big_label”); // For control in CSS using .big_label{} (for example)
label.setContentMode( Label.CONTENT_XHTML ); // Interpret the label’s contents as XHTML rather than literally.
label.setValue( text.toString() );
v.addComponent(label);
getUI().addWindow(w);
w.focus();
w.addCloseListener(new CloseListener() {
private static final long serialVersionUID = -3468147712134285799L;
@Override
public void windowClose(CloseEvent e) {
w.close();
}
}); }
else if (strSelectedItem.equalsIgnoreCase(“sales report”)) {
final Window w = new Window(“Sales report Help”);
VerticalLayout v = new VerticalLayout();
v.setMargin(true);
v.setSpacing(true);
w.setModal(false);
w.setContent(v);
w.setWidth(“300px”);
w.addStyleName(“notifications”);
w.setClosable(true);
w.setResizable(false);
w.setDraggable(false);
w.setPositionX(event.getClientX() - event.getRelativeX());
w.setPositionY(event.getClientY() - event.getRelativeY());
w.setCloseShortcut(KeyCode.ESCAPE, null);
StringBuilder text = new StringBuilder();
text.append( “

This set of panels asks you a couple dozen questions. From those questions AcmeCoach will build a complete document.

\n” );
Label label = new Label();
label.setStyleName( “big_label”); // For control in CSS using .big_label{} (for example)
label.setContentMode( Label.CONTENT_XHTML ); // Interpret the label’s contents as XHTML rather than literally.
label.setValue( text.toString() );
v.addComponent(label);
getUI().addWindow(w);
w.focus();
w.addCloseListener(new CloseListener() {
private static final long serialVersionUID = -3468147712134285799L;
@Override
public void windowClose(CloseEvent e) {
w.close();
}
});

hi “info log” … i tested your previous code:
i belive the problem is not with your windows.
you need to check the value of your strSelectedItem
try set these :

//test = #0 String strSelectedItem = (counter == 0)?"process timeline report":"sales report"; and yes you need declare : private int counter = 0; as a global variable.
finaly i added:

counter++; after your code and everything Safe & Sound.
the first one closed, the second one opend.

i notice that you are using:

addCloseListener(new CloseListener() { private static final long serialVersionUID = -3468147712134285799L; @Override public void windowClose(CloseEvent e) { w.close(); } }); #to force closed window to close → there is no need.
#try don’t use Strings inside control statements you know hard to maintance and so on.

i wish that can be help.

Hi matar,
as u said the problem is with strSelectedItem,
i was changed the location for this i got the solution
thanks,