1
時不關閉整個JVM我創建這樣一個圖表使用xchart Java庫(http://knowm.org/open-source/xchart/)如何關閉xchart圖表
public void createHistogram(String title, String xTitle, String yTitle, ArrayList<String> xDataSet, ArrayList<Integer> yDataSet) {
CategoryChart chart = new CategoryChartBuilder().width(800).height(600).title(title).xAxisTitle(xTitle).yAxisTitle(yTitle).build();
chart.getStyler().setLegendPosition(LegendPosition.InsideNW);
chart.getStyler().setHasAnnotations(true);
chart.addSeries("test1", xDataSet, yDataSet);
new SwingWrapper(chart).displayChart().setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
但是每一次我按下圖的窗口上退出的時候,它會縮小整個應用。有沒有解決方法?
Ps。我嘗試將「JFrame」更改爲WindowsConstants,ApplicationFrame和SwingWrapper,以查看它是否對它有任何影響,但目前爲止沒有運氣。
您是否試過'JFrame.HIDE_ON_CLOSE'? –
是的。同樣的結果。同時在括號內自己嘗試了「HIDE_ON_CLOSE」和「DISPOSE_ON_CLOSE」,沒有運氣。 – peterxz