I want to appear two differenet Frames with different results in eachone. My code is :
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);
After this, I write some code so as to change the index of the last frame and then i run again this :
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);
Then they appear both of the frames but they have the same information. this is wrong. Any help please?