我想在每个人身上出现两个具有不同结果的不同框架。我的代码是:
JFrame frame = new JFrame("Before the outage in Maximization");
MyCanvas canvas = new MyCanvas(initials.vaccesspoint,initials.vTerminal);
frame.setSize(initials.frameSize, initials.frameSize);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(canvas);
frame.setVisible(true);
Graphics graph = canvas.getGraphics();
canvas.paintComponent(graph);
在此之后,我编写了一些代码以更改最后一帧的索引,然后我再次运行:
JFrame frame2 = new JFrame("Before the outage in Maximization");
MyCanvas canvas2 = new MyCanvas(initials.vaccesspoint,initials.vTerminal);
frame2.setSize(initials.frameSize, initials.frameSize);
frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame2.add(canvas2);
frame2.setVisible(true);
Graphics graph2 = canvas2.getGraphics();
canvas2.paintComponent(graph2);
然后它们出现两个框架,但它们具有相同的信息。这是错误的。请问有什么帮助吗?