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