I want that graph to pop up in another window though
Launch a JDialog and add the graphic component (JPanel) to it.
Somewhere in_or_called_from_your_event_code:
GraphicPanel graphicPanel = new GraphicPanel(image, data);
JDialog dialog = new JDialog(desired_args);
dialog.add(graphicPanel);
// configure dialog as desired
dialog.setVisible(true);
How do I draw that background image into the program ?
class GraphicPanel extends JPanel {
BufferedImage bgImage;
int[][] data;
GraphicPanel(BufferedImage image, int[] data) {
bgImage = image;
this.data = data;
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
int x = 10;
int y = 10;
g.drawImage(bgImage, x, y, this);
// draw your grid lines...
// draw your data points/lines as desired...
}
}