pdlarue
asked on
Error in getSize() getter - creating a size property that is an int array of height and width
Experts:
I'm trying to create a size property that is an int array of height and width:
private int [] size = new int [2];
public int [] getSize() { // getSize() is underlined in red "here is my error"
size[0] = height;
size[1] = width;
return size;
}
public void setSize(int h, int w) {
height = h;
width = w;
}
When I hover the cursor over the getSize() it pops up the following message:
The return type is incompatible with Component.getSize()
I've gone through all of my code looking for incompatibilities and I can't find any. So, I'm beginning to think there is something wrong with my syntax.
Any ideas?
Thanks,
Patricia
I'm trying to create a size property that is an int array of height and width:
private int [] size = new int [2];
public int [] getSize() { // getSize() is underlined in red "here is my error"
size[0] = height;
size[1] = width;
return size;
}
public void setSize(int h, int w) {
height = h;
width = w;
}
When I hover the cursor over the getSize() it pops up the following message:
The return type is incompatible with Component.getSize()
I've gone through all of my code looking for incompatibilities and I can't find any. So, I'm beginning to think there is something wrong with my syntax.
Any ideas?
Thanks,
Patricia
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:-)