Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

RectangleDemo

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic