我们开发了一个基于Java 1.7(在eclipse中)开发的插件项目,并在java 1.6上构建(构建工具在Java 1.6上,我们很快就会升级到Java 1.7)。
我们在代码中使用密钥监听器,当核心应用程序在Java 1.7上运行时运行良好,但核心应用程序在Java 1.6上运行时却没有(当前生产环境在Java 1.6上运行,后者将进一步迁移到java 1.7)
任何想法,我们能为这个问题做些什么?
txtInput.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
setAdjusting(cbInput, true);
keyEvent = false;
if (e.getKeyCode() == KeyEvent.VK_ENTER
|| e.getKeyCode() == KeyEvent.VK_UP
|| e.getKeyCode() == KeyEvent.VK_DOWN ) {
selectionAllowed = true;
e.setSource(cbInput);
cbInput.dispatchEvent(e);
keyEvent = true;
if (e.getKeyCode() == KeyEvent.VK_DOWN
|| e.getKeyCode() == KeyEvent.VK_UP ) {
if(cbInput.getSelectedItem() != null ) {
txtInput.setText(cbInput.getSelectedItem().toString());
}
}
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
cbInput.setPopupVisible(false);
if(txtInput.getText() != null ) {
try {
BFMDateTime end_date;
BRMap map = new BRMap();
map.putElem("content", txtInput.getText().trim());
map.putElem("action", "ButtonClicked");
map.putElem("start_date", timeZone.bfmDateToSearchFormat(new BFMDateTime(uiObj.fromDate.getText().toString())));
end_date = new BFMDateTime(uiObj.toDate.getText().toString());
end_date.addHours(23);
end_date.addMinutes(59);
end_date.addSeconds(59);
map.putElem("end_date", timeZone.bfmDateToSearchFormat(end_date));
CommandMsg commandMsg = new CommandMsg(AppConstants.DEALER_SEARCH_COMMAND, map);
RequestHandler requestHandler = new RequestHandler();
requestHandler.handleRequest(commandMsg,AppConstants.RESPONSE_SOURCE,uiObj);
} catch (NumberFormatException e1) {
e1.printStackTrace();
} catch (BFMTimeException e1) {
e1.printStackTrace();
}
}
}
}
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
cbInput.setPopupVisible(false);
}
setAdjusting(cbInput, false);
}
});