我有一个JPanel和JButton类。点击按钮时,我想在我的JPanel中显示图形。图形是在不同的类。有人可以帮我做这个吗? GUI类: public class Gui extends JFrame implements ActionListener{
JButton showGraph;
public Gui() {
super("GUI");
让我首先说我找到了以下内容,但没有一个解决方案适用于我。 Cells gets overlapped and painted when Scroll happens in DataGridView DataGridView overrides my custom row painting DataGridView CellPainting Not Fully Working on Scroll 在
我看了一篇教程并试图做同样的事情,我编写的代码完全一样,但没有显示任何内容。我认为这是因为paintComponent方法没有被调用,我也尝试通过paintComponent打印某些内容到控制台。 这里是我的代码: public class Line extends JPanel{
@Override
public void paintComponents(Graphics