measuresDialog.setVisible(false);
measuresDialog.setVisible(true);  new Thread(new Runnable() { public void run() { JTextArea first = null; measuresPanel.setLayout(new BoxLayout(measuresPanel, BoxLayout.Y_AXIS)); for (int i = 0; i < MEASURES.length; i++) { final JPanel measurePanel = new JPanel(new BorderLayout()); JTextArea text = new JTextArea(); text.setEditable(false); text.setLineWrap(true); text.setWrapStyleWord(true); text.setOpaque(false); text.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));  text.append(MEASURES[i].getDescription()); measurePanel.add(text); JButton add = new JButton("Add"); final int index = i; add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { measure.addObject(MEASURES[index]); measuresDialog.setVisible(false); } }); measurePanel.add(add, BorderLayout.EAST); if (first == null) { first = text; EventQueue.invokeLater(new Runnable() { public void run() { measuresPanel.add(measurePanel); } }); } else { EventQueue.invokeLater(new Runnable() { public void run() { JPanel separator = new JPanel(); separator.setPreferredSize(new Dimension(0,5)); measuresPanel.add(separator); measuresPanel.add(measurePanel); measuresPanel.revalidate(); } }); } }  final JTextArea ffirst = first; EventQueue.invokeLater(new Runnable() { public void run() { ffirst.setCaretPosition(0); } });
					public void actionPerformed(ActionEvent e) {						measuresDialog.setVisible(false);					}