sách gpt4 ai đã đi

jpanel - jPanel 图表面板中的 Jfreechart 不显示

In lại 作者:行者123 更新时间:2023-12-04 11:33:43 30 4
mua khóa gpt4 Nike

我已经创建了 JFreeChart 并将其放入图表面板(按照建议)。我还将它添加到 jPanel 中。我正在使用 jFrame。但是运行程序后我的图表不可见。有谁能帮帮我吗?

final JFreeChart chart = ChartFactory.createXYLineChart(
"XY Series Demo",
"iterácie",
"%",
data,
PlotOrientation.VERTICAL,
true,
true,
SAI
);

final ChartPanel chartPanel = new ChartPanel(chart);
//chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
chartPanel.setDomainZoomable(true);
chartPanel.setVisible(true);
jPanel1.add(chartPanel, BorderLayout.CENTER);

1 Câu trả lời

(在问题编辑中回答。转换为社区维基答案。参见 What is the appropriate action when the answer to a question is added to the question itself?)

OP 写道:

[SOLVED] I was missing these two:

jPanel1.setLayout(new java.awt.BorderLayout());
jPanel1.validate();

关于jpanel - jPanel 图表面板中的 Jfreechart 不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15144370/

30 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com