Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RectangleDemo

 
micheal frost
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below is my code for the RectangleDemo program



these are the things the compiler is complaining about

C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:42: x is not public in java.awt.Component; cannot be accessed from outside package
+ rect.x + ", " + rect.y + ") to ("
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:42: y is not public in java.awt.Component; cannot be accessed from outside package
+ rect.x + ", " + rect.y + ") to ("
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:43: x is not public in java.awt.Component; cannot be accessed from outside package
+ (rect.x + rect.width - 1) + ", "
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:43: width is not public in java.awt.Component; cannot be accessed from outside package
+ (rect.x + rect.width - 1) + ", "
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:44: y is not public in java.awt.Component; cannot be accessed from outside package
+ (rect.y + rect.height - 1) + ").");
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:44: height is not public in java.awt.Component; cannot be accessed from outside package
+ (rect.y + rect.height - 1) + ").");
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:91: cannot find symbol
symbol : constructor Rectangle(int,int,int,int)
location: class Rectangle
currentRect = new Rectangle(x, y, 0, 0);
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:109: x is not public in java.awt.Component; cannot be accessed from outside package
currentRect.setSize(x - currentRect.x,
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:110: y is not public in java.awt.Component; cannot be accessed from outside package
y - currentRect.y);
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:126: x is not public in java.awt.Component; cannot be accessed from outside package
g.drawRect(box.x, box.y,
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:126: y is not public in java.awt.Component; cannot be accessed from outside package
g.drawRect(box.x, box.y,
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:127: width is not public in java.awt.Component; cannot be accessed from outside package
box.width - 1, box.height - 1);
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:127: height is not public in java.awt.Component; cannot be accessed from outside package
box.width - 1, box.height - 1);
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:133: x is not public in java.awt.Component; cannot be accessed from outside package
int x = originalRect.x;
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:134: y is not public in java.awt.Component; cannot be accessed from outside package
int y = originalRect.y;
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:135: width is not public in java.awt.Component; cannot be accessed from outside package
int width = originalRect.width;
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:136: height is not public in java.awt.Component; cannot be accessed from outside package
int height = originalRect.height;
^
C:\Documents and Settings\ABK\My Documents\PA\RectangleDemo.java:173: cannot find symbol
symbol : constructor Rectangle(int,int,int,int)
location: class Rectangle
return new Rectangle(x, y, width, height);
^
18 errors

Tool completed with exit code 1
 
Manuel Moons
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure about this?

I just compiled this code without any problems.

It should work. The errors you are getting do not make sense.

Maybe you are compiling another file? Make sure that you are using the code that you provided here!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic