Results 1 to 6 of 6
  1. #1
    irishhokie is offline Member
    Join Date
    Apr 2009
    Location
    Blacksburg
    Posts
    2
    Rep Power
    0

    Default Hello everyone! quick question.

    I am working on a Java project and I am trying to set up coordinates as an int for an if statement. I'm not the best with the jargon, but basically what I'm trying to do is set up an if statement where if a randomly drawn pixel is within (50, 250) it will be drawn red and if it is within (75, 250) it will be drawn blue. My question is when I declare the ints can I use a code line such as this?

    private final int NUM_PIXELS = 10000, THICKNESS = 1, LOCATION_A = (50, 250), LOCATION_B = (75, 250);

    I currently get an error ')' expected.

    Hopefully this question isn't too stupid for everyone, thanks!

    Oh, Hello everyone btw!

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    This is not a valid declaration.

    Java Code:
    LOCATION_A = (50, 250)
    That's why you get the error message.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  4. #4
    Natrix is offline Member
    Join Date
    Mar 2009
    Posts
    40
    Rep Power
    0

    Default

    I think there are methods to get and set location.

    getLocation(int x, int y)
    setLocation(int x, int y)

    Should be similar for some objects. We used it with JFrames.
    A good thing would be to check out the documentation.

  5. #5
    irishhokie is offline Member
    Join Date
    Apr 2009
    Location
    Blacksburg
    Posts
    2
    Rep Power
    0

    Default

    Hey thanks for your help all! I think I got it :D

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Did you notice that what the error is. If you can let it know here, how did you find the solution?

    If you solve the problem please mark the thread solved.

Similar Threads

  1. One last quick question
    By jigglywiggly in forum New To Java
    Replies: 7
    Last Post: 01-26-2009, 09:53 AM
  2. Quick Question
    By Graeme in forum New To Java
    Replies: 4
    Last Post: 01-08-2009, 09:01 PM
  3. Quick Question
    By Spenc in forum New To Java
    Replies: 3
    Last Post: 09-22-2008, 03:26 PM
  4. quick easy question
    By jmHoekst in forum New To Java
    Replies: 1
    Last Post: 06-19-2008, 04:28 PM
  5. Quick question about sorting
    By nbd223 in forum New To Java
    Replies: 10
    Last Post: 04-28-2008, 10:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •