private static <T> void handleWindows(final String framesetid, final Class<? extends Component> clz, Component comp) {
        if (comp instanceof Window) {
            TitleIconImage title = clz.getAnnotation(TitleIconImage.class);
            if (title != null) {
                setWindowTitle(comp, title);
                setIconImage(comp, title);
            }

            boolean addWindowCloseListener=true;
            if(comp instanceof JFrame){
                if(((JFrame)comp).getDefaultCloseOperation()==JFrame.DO_NOTHING_ON_CLOSE){
                    addWindowCloseListener=false;
                }
            }
            if(addWindowCloseListener){
                ((Window) comp).addWindowListener(new WindowAdapter() {
                    @Override
                    public void windowClosing(WindowEvent e) {
                        FrameFactory.dispose(framesetid, clz);
                        super.windowClosing(e);
                    }
                });
            }
        }
    }