Hi, just for some background I have no experience with java, I tend to stick to c (embedded), vhdl and python. I know how to do what I want in python but I am using this project of mine as a motivator to learn some java. I (eventually) want an app that can show me multiple live graphs simultaneously with data obtained from a separate computer using python socket as a server. For now I am using java swing to build a GUI and am trying to add a single graph (not real time, for now) to a JPanel. I tried using JFreeChart, but it seems out of my reach and now I am trying to use xchart.

my questions are how can I add a graph to a jpanel (in my case panel_1)? and is there another graph library that you think is more suited to what I want to do?

this is the code that I am running now:
Application.java

package Common;

import java.awt.EventQueue;

import Windows.MainWindow;

public class Application {

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainWindow frame = new MainWindow();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

}


and
mainWindow.java

package Windows;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTabbedPane;
import javax.swing.JScrollPane;
import java.awt.GridLayout;
import javax.swing.JButton;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JLabel;

public class MainWindow extends JFrame {
private JPanel contentPane;
/**
* Create the frame.
*/
public MainWindow() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);

JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
contentPane.add(tabbedPane, BorderLayout.CENTER);

JScrollPane scrollPane = new JScrollPane();
tabbedPane.addTab("New tab", null, scrollPane, null);

JPanel panel = new JPanel();
scrollPane.setViewportView(panel);
GridBagLayout gbl_panel = new GridBagLayout();
gbl_panel.columnWidths = new int[]{208, 208, 0};
gbl_panel.rowHeights = new int[]{110, 110, 0};
gbl_panel.columnWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
gbl_panel.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
panel.setLayout(gbl_panel);

JPanel panel_1 = new JPanel();
GridBagConstraints gbc_panel_1 = new GridBagConstraints();
gbc_panel_1.fill = GridBagConstraints.BOTH;
gbc_panel_1.insets = new Insets(0, 0, 5, 5);
gbc_panel_1.gridx = 0;
gbc_panel_1.gridy = 0;
panel.add(panel_1, gbc_panel_1);
setVisible(true);
}

}