• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Someone Please, Help.. having Syntax problems with p.getx().. PLEASE

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prog3.java:30: cannot resolve symbol
symbol : method getx ()
location: class Point
p.getx(); //getting x and y to use in the movements
^
Prog3.java:31: cannot resolve symbol
symbol : method gety ()
location: class Point
p.gety();

theres my two errors i am getting mostly
p.getx();
p.gety();
thats all i have in my code.. whats wrong?
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Capitalize the "X" and "Y". The methods are getX() and getY().
Java is sensitive that way.
 
greg layfield
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks... i did that and it corrected it.. but now i am getting this:

Prog3.java:34: cannot resolve symbol
symbol : variable X
location: class Prog3
g.drawLine(X, Y, X, Y - 1);

heres my method:
public void move(int dir, Point p, Graphics g)
{
getX(); //getting x and y to use in the movements
getY();

if(dir == 0)
g.drawLine(X, Y, X, Y - 1);
p.setPoint(X, Y);

if(dir == 1)
g.drawLine(X, Y, X + 1, Y - 1);
p.setPoint(X, Y);

if(dir == 2)
g.drawLine(X, Y, X + 1, Y);
p.setPoint(X, Y);

if(dir == 3)
g.drawLine(X, Y, X + 1, Y + 1);
p.setPoint(X, Y);

if(dir == 4)
g.drawLine(X, Y, X, Y + 1);
p.setPoint(X, Y);

if(dir == 5)
g.drawLine(X, Y, X - 1, Y + 1);
p.setPoint(X, Y);

if(dir == 6)
g.drawLine(X, Y, X - 1, Y);
p.setPoint(X, Y);

if(dir == 7)
g.drawLine(X, Y, X - 1, Y - 1);
p.setPoint(X, Y);
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you not need int X = p.getX(); ? ( Similarly for Y )
Hard to say what you need to do because there's not enough program listed.
reply
    Bookmark Topic Watch Topic
  • New Topic