import java.awt.*; import javax.swing.*; /* * A sample implementation of a panel that draws the chart. Extend this * class with drawing logic or use your own layouts and components. */ public class ChartPanel extends JPanel { public int[][] dataArray; public int dim2; //# of data points public int w; public void paintComponent(Graphics gl) { Graphics2D g = (Graphics2D) gl; //the Background part - Just draw once perhaps g.setColor(new Color(222, 222, 222)); g.fillRect(0, 0, this.getWidth(), this.getHeight()); g.setColor(new Color(250, 0, 0)); g.drawLine(10, 10, 10, 310); //max y-axis of 300 g.drawLine(10, 310, dim2*50+10, 310); //variable x-axis g.drawString("100ms", 2, 210); g.drawString("200ms", 2, 110); g.drawString("300ms", 2, 10); //the update part if(w