先贴代码。
public void actionPerformed(ActionEvent e) {

// if the start the button is clicked
// logic = new ParserWrapper(this);
// logic.addPropertyChangeListener(this);
if (e.getSource() == btnStart) {
btnStart.setEnabled(false);
btnClose.setEnabled(false);
btnStop.setEnabled(true);
this.stop = false;
writeToGUI("############ START ############");
errorLogger.log("######## GUI START ########");

logic = new ParserWrapper(this);

logic.setProgramStartTime(new java.sql.Timestamp(System.currentTimeMillis()).getTime());
 synchronized(this){
logic.addPropertyChangeListener(this);
logic.execute();
}
// logic.addPropertyChangeListener(this);
// logic.execute();
} if (e.getSource() == btnStop) {

this.stop = true;
btnStop.setEnabled(false);
btnStart.setEnabled(true);
btnClose.setEnabled(true);
//      logic.addPropertyChangeListener(this);
logic.stop();
//this.repaint();p

}
if (e.getSource() == btnClose) {
System.exit(0);
}
this.repaint();
}
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("finished")) {
Boolean value = (Boolean) evt.getNewValue();
if (value) {
errorLogger.log("######## GUI STOP ########");
writeToGUI("############ STOP ############");
writeToGUI(logic.getProcessedFilesCounter() + " logfiles im Schnitt " + logic.getAverage().getMillis());
writeToGUI(logic.getMaxTime().toDuration().toStandardSeconds() + "sec");
writeToGUI(logic.getMaxFilesizeString());
writeToGUI("###############################");
errorLogger.log(";Anzahl;" + logic.getProcessedFilesCounter()); btnClose.setEnabled(value);
btnClose.setText("Close");
btnStop.setText("Stop");
      btnStart.setEnabled(value);
this.repaint();
}
}
}
问题〉〉
两个函数,用gui显示内容,现在的问题是,当出现gui界面时,点start按钮开始工作时,同时stop按钮也显示黑的,不能点,但是我在监听函数已近设置了,当点start按钮时,stop按钮是可以点击的,这让我很不明白。请教大家。