0

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
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by powerson65
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.