This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes RectangleDemo Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "RectangleDemo" Watch "RectangleDemo" New topic
Author

RectangleDemo

micheal frost
Greenhorn

Joined: Aug 24, 2005
Posts: 5
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

Joined: Mar 05, 2002
Posts: 229
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!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: RectangleDemo