enter image description here

The method drawLine(int,int,int,int) is undefined for the type Graphics 

Previously, having worked the code) Now there is none. It seems that's right ...

  • one
    What error gives? Hover over the red cross and copy here. Wanghui lack of required imports - rjhdby
  • The method drawLine (int, int, int, int) is undefined for the type Graphics - coder228

2 answers 2

You already have a Graphics class in your project. Accordingly, there is no method you need. In this case, you should explicitly specify the path to the Graphics class, that is, prescribe java.awt.Graphics. That is, your method signature should look something like this: public void paint(java.awt.Graphics g)

    The error tells us that you do not have the drawLine(int,int,int,int) method drawLine(int,int,int,int) in the Graphics class

    But I, too, do not see at the very top of the line

     import Graphics; 
    • This class is included in the package java.awt - a.chugunov
    • one
      And why is he present in the project separately? Can't Eclipse blow it off your head? - rjhdby
    • Yes, apparently, the class is trying to be used next to Zadacha1, instead of the class from the awt - a.chugunov package.