提交 d5919b03 编写于 作者: Y ysuenaga

8144332: HSDB could not terminate when close button is pushed.

Reviewed-by: jbachorik
上级 4eee399e
......@@ -128,10 +128,14 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
}
}
// close this tool without calling System.exit
protected void closeUI() {
workerThread.shutdown();
frame.dispose();
private class CloseUI extends WindowAdapter {
@Override
public void windowClosing(WindowEvent e) {
workerThread.shutdown();
frame.dispose();
}
}
public void run() {
......@@ -147,7 +151,8 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
frame = new JFrame("HSDB - HotSpot Debugger");
frame.setSize(800, 600);
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
frame.addWindowListener(new CloseUI());
JMenuBar menuBar = new JMenuBar();
......@@ -210,7 +215,8 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
item = createMenuItem("Exit",
new ActionListener() {
public void actionPerformed(ActionEvent e) {
closeUI();
workerThread.shutdown();
frame.dispose();
}
});
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册