/**
  * Creates a window for reporting progress. The window will not appears immediately. It will
  * appears only when the {@link #started} method will be invoked.
  *
  * @param parent The parent component, or {@code null} if none.
  */
 public ProgressWindow(final Component parent) {
   /*
    * Creates the window containing the components.
    */
   Dimension parentSize;
   final Vocabulary resources =
       Vocabulary.getResources(parent != null ? parent.getLocale() : null);
   final String title = resources.getString(VocabularyKeys.PROGRESSION);
   final JDesktopPane desktop = JOptionPane.getDesktopPaneForComponent(parent);
   if (desktop != null) {
     final JInternalFrame frame;
     frame = new JInternalFrame(title);
     window = frame;
     content = new JPanel(); // Pour avoir un fond opaque
     parentSize = desktop.getSize();
     frame.setContentPane(content);
     frame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
     desktop.add(frame, JLayeredPane.PALETTE_LAYER);
   } else {
     final JDialog dialog;
     dialog = new JDialog((Frame) null, title);
     window = dialog;
     content = (JComponent) dialog.getContentPane();
     parentSize = Toolkit.getDefaultToolkit().getScreenSize();
     dialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
     dialog.setResizable(false);
   }
   window.setBounds(
       (parentSize.width - WIDTH) / 2, (parentSize.height - HEIGHT) / 2, WIDTH, HEIGHT);
   /*
    * Creates the label that is going to display the undergoing operation.
    * This label is initially empty.
    */
   description = new JLabel();
   description.setHorizontalAlignment(JLabel.CENTER);
   /*
    * Creates the progress bar.
    */
   progressBar = new JProgressBar();
   progressBar.setIndeterminate(true);
   progressBar.setBorder(
       BorderFactory.createCompoundBorder(
           BorderFactory.createEmptyBorder(6, 9, 6, 9), progressBar.getBorder()));
   /*
    * Creates the cancel button.
    */
   cancel = new JButton(resources.getString(VocabularyKeys.CANCEL));
   cancel.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           setCanceled(true);
         }
       });
   final Box cancelBox = Box.createHorizontalBox();
   cancelBox.add(Box.createGlue());
   cancelBox.add(cancel);
   cancelBox.add(Box.createGlue());
   cancelBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
   /*
    * Layout the elements inside the window. An empty border is created in
    * order to put some space between the window content and the window border.
    */
   final JPanel panel = new JPanel(new GridLayout(2, 1));
   panel.setBorder(
       BorderFactory.createCompoundBorder(
           BorderFactory.createEmptyBorder(VMARGIN, HMARGIN, VMARGIN, HMARGIN),
           BorderFactory.createEtchedBorder()));
   panel.add(description);
   panel.add(progressBar);
   content.setLayout(new BorderLayout());
   content.add(panel, BorderLayout.NORTH);
   content.add(cancelBox, BorderLayout.SOUTH);
 }