Hi!
Basically I am trying to add the graph inside the Jpanel which already exists. I am getting the erorr "adding a window to a container"
Here is my code
public void displayGraph(){
try{
String sql = "Select pressure, ventilage from statstbl";
DBCon conn = new DBCon();
JDBCCategoryDataset dataset = new JDBCCategoryDataset(conn.connect(),sql);
JFreeChart chart = ChartFactory.createLineChart("Chart", "Pressure", "Ventilage", dataset, PlotOrientation.VERTICAL, false, true, true);
BarRenderer renderer = null;
CategoryPlot plot = null;
renderer = new BarRenderer();
ChartFrame frame = new ChartFrame("Statistics",chart);
jPanel3.add(frame, BorderLayout.CENTER);
jPanel3.validate();
frame.setVisible(true);
frame.setSize(500,650);
}catch(Exception ex){
JOptionPane.showMessageDialog(null,ex.getMessage(),"Error",JOptionPane.ERROR_MESSAGE);
}
}