Hi,

I would like to create a popup window that keeps the focus until the
"OK" button has been clicked. This popup window is to select a specific
dataset in an ABINIT output file. In ABINITReader, I have something
like:

....

selectDataset(dataset)

....

I would like that selectDataset stops the code until "OK" has been
clicked


The selectDataset code is:

protected int selectDataset(Vector dataset) {
    
    final JFrame myframe = new JFrame("");
    JPanel panel = new JPanel();
    JLabel mylabel = new JLabel("There is " + dataset.size() + "
dataset" 
                                + " in this file. Please select one."  );
    JButton ok = new JButton("OK");
    myframe.setDefaultCloseOperation
      (javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    ok.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          myframe.dispose();
        }
      });
    
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    panel.setLayout(gridbag);
    c.gridwidth = GridBagConstraints.REMAINDER;
    gridbag.setConstraints(mylabel, c);
    panel.add(mylabel);
    panel.add(ok);
    myframe.getContentPane().add(panel);
    
    myframe.pack();
    myframe.setVisible(true);

    return datasetNumber      //still to be implemented

  }    //end selectDataset


Do you have some hints?

Fabian

-- 


**********
Fabian Dortu

Phone   : 32-475-599268
e-mail : [EMAIL PROTECTED]
*********************************************** 


Attachment: signature.asc
Description: PGP signature

Reply via email to