protected void init() {
      
      this.setTitle(descriptor.getWindowTitle());
            
      //add default action listeners for this descriptor if there aren't any yet
      if(descriptor.getActionListeners().isEmpty()) {
         defaultActionListener = new ConfirmDialogActionListener();
         descriptor.addActionListener(defaultActionListener);
      }
      
      mainPanel = new DialogPanel(descriptor);
      getContentPane().add(mainPanel);
      mainPanel.initDefaultButton();
      
      if(descriptor.getPack() || descriptor.getWidth()==0 || descriptor.getHeight()==0) {
         pack();
      }
      
      //set width
      if(descriptor.getWidth() > getWidth()) {
         setSize(descriptor.getWidth(), getHeight());
      }
      
      //set height
      if(descriptor.getHeight() > getHeight()) {
         setSize(getWidth(), descriptor.getHeight());
      }
      
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      if(getWidth()>screenSize.width) setSize(screenSize.width, getHeight());
      if(getHeight()>screenSize.height) setSize(getWidth(), screenSize.height);      
      
      centerLocation();
      
      setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
      setResizable(descriptor.getResizable());
            
      addWindowListener(new WindowAdapter() {
         public void windowClosed(WindowEvent e) {
            descriptor.removeActionListener(defaultActionListener);
         }
      });
   }