0

So First, my chart generating code is:

class Cv implements ActionListener {
    public void actionPerformed(ActionEvent arg0) {


          while(true){ 
              try {
                  List<Date> PAdate = getPADate();
                  List<Integer> PAdata = getPAData();

                  int count =getRows();
                  final XYChart chart =   new XYChart(count,count);

                  final SwingWrapper sw = new SwingWrapper(chart);
                  XYSeries series =  chart.addSeries("PA",PAdate,PAdata);


                  chart.setHeight(500);
                  chart.setWidth(1500);

                  chart.setTitle("Courbes en temps réel des paramètres capturées");
                  chart.setXAxisTitle("Date");chart.setYAxisTitle("Paramètre");

                  sw.displayChart("Paramètre");
                  Thread.sleep(10000);
              } catch (SQLException | InterruptedException ex) {
                  Logger.getLogger(Cv.class.getName()).log(Level.SEVERE, null, ex);
              }

       }

        }}

this method belongs to the class which implements ActionListener, so i want to execute this class with pressing on the button in Jframe panel. I try with the flowing code but the chart is not appearing in the panel but the class is succesfuly executing:

public class SimpleRealTime extends JComponent{
    private JFrame  visualiser = new JFrame("Visualiser les paramètres");
    private JPanel  pane       = new JPanel();
    private JButton courbe     = new JButton("Courbe pression");
    private JButton quitter    = new JButton("Quitter");
    public SimpleRealTime() {
    visualiser.setSize(500,500);
    visualiser.setVisible(true);
    visualiser.add(pane);
    pane.add(courbe);
    pane.add(quitter);   
    courbe.addActionListener(new Cv());
    quitter.addActionListener(new Ferme());  
}

So can someone help me plz! and what can i write in the main method? thank you.

0 Answers0