Hi i have a program with a JFrame and it has two jpanels on it, one containing the buttons needed and the other which is going to be used for plotting graphs, but when i try to plot an x, y graph on the plotting jpanel it does not show up. any idea of what i can do, thank you for any help that can be given.

This is the code for making the graph

@Override
    public void paintComponents(Graphics g)
    {
        super.paintComponents(g);


     g.setFont(new Font("Courier New", Font.BOLD,16));
      
      g.setColor(Color.BLUE);
      g.drawLine(200,200,200,350); // x-axis
      g.drawLine(0,350,1400,350);// y-axis

That should be paintComponent - no "s"

Hi JamesCherrill have tried to change the paintComponents to paintComponent but it gave me errors as it cannot find the method.
I think that i need to make a class or method for the jpanel in question were i would like to draw than override it, as the two jpanels are visible on the same jframe. Thanks a lot for the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.