okay, I'm trying to create a new instance of SimpleCanvas through the FlagDrawer object. I need the SimpleCanvas to be scalable. I can only use the two instance variables and one constructor given to me. What I'm trying to do now is take the class instance variable (int) size and get that value into two temporary constructor variables, width and height so I can then get it into the SimpleCanvas sc.width and sc.height

it's not happening man. this error message comes up. It only happens when I put in the sc = new SimpleCanvas etc.

cannot find symbol - constructor for SimpleCanvas(int,int) is the error message I get.

public class FlagDrawer
    // instance variables - replace the example below with your own
    private int size;
    private SimpleCanvas sc;

    public FlagDrawer(int size)
        // initialise instance variables     
        int width;
        int height;
        this.size = width;
        this.size = height;    
        sc = new SimpleCanvas (width, height);
    public void sampleMethod()
        // put your code here
        //return x + y;

please halp

Edited by ausops: didn't wrap code properly

6 Years
Discussion Span
Last Post by NormR1

this error message comes up

You forgot to post the error message.
Please post the full text of the error message. It has more info than your edited version.

constructor for SimpleCanvas(int,int)
Does the SimpleCanvas class have a constructor that takes two int args?


I'm not sure how I can get a more detailed error message.

The simple canvas has three constructors.

public SimpleCanvas(String title, int width, int height, boolean autoRepaint) {
public SimpleCanvas(String title, int width, int height) {
public SimpleCanvas() {

Here is a sample of what an error message looks like:

TestCode1.java:33: ';' expected
      Scanner sc = new Scanner(input);
1 error

It includes the source file name, the line number of the error and the source line with the error with a ^ pointing to the approximate location of the error.

The error was because there was not a constructor matching: SimpleCanvas(int,int)

This question has already been answered. 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.