No código abaixo estou recebendo um IllegalMonitorStateException e não sei o motivo. Alguem poderia me ajudar???
//Na classe TestCashDispenserPanel
private JButton getBtnStartExchange() {
if (btnStartExchange == null) {
btnStartExchange = new JButton();
//btnStartExchange.setText(“StartExchange”);
btnStartExchange.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
try {
Vector unit = new Vector();
synchronized (m_cTestDlg) {
StartExchangeDialog startExchangeDialog =
new StartExchangeDialog(TestCashDispenserPanel.this, m_cLocal, unit);
try {
System.out.println("Wait");
this.wait(60000);
System.out.println("End Wait");
} catch (InterruptedException e1) {
System.out.println("Problems with wait");
e1.printStackTrace();
}
//Any Code
new InternalJxfsEventAdapter() { ...
}
});
}
return btnStartExchange;
}
//Na classe StartExchangeDialog
if (btnOK == null) {
btnOK = new JButton();
btnOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//m_cOwner = Instacia TestCashDispenserPanel
synchronized(m_cOwner){
if(chkCashUnit1.isSelected())
//Objeto recebido
units.add(new Integer(1));
if(chkCashUnit2.isSelected())
v_Units.add(new Integer(2));
if(chkCashUnit3.isSelected())
v_Units.add(new Integer(3));
if(chkCashUnit4.isSelected())
v_Units.add(new Integer(4));
if(chkCashUnit5.isSelected())
v_Units.add(new Integer(5));
System.out.println("notify");
m_cOwner.notifyAll();
}
StartExchangeDialog.this
.dispatchEvent(new WindowEvent(
StartExchangeDialog.this,
WindowEvent.WINDOW_CLOSING));
}
});
}
return btnOK;
}
}