Results 1 to 6 of 6
Thread: Hello everyone! quick question.
- 04-02-2009, 06:36 AM #1
Member
- Join Date
- Apr 2009
- Location
- Blacksburg
- Posts
- 2
- Rep Power
- 0
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!
- 04-02-2009, 06:55 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
This is not a valid declaration.
That's why you get the error message.Java Code:LOCATION_A = (50, 250)
- 04-02-2009, 06:56 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
And this is too.
Java Code:LOCATION_B = (75, 250)
- 04-02-2009, 09:44 PM #4
Member
- Join Date
- Mar 2009
- Posts
- 40
- Rep Power
- 0
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.
- 04-03-2009, 01:40 AM #5
Member
- Join Date
- Apr 2009
- Location
- Blacksburg
- Posts
- 2
- Rep Power
- 0
Hey thanks for your help all! I think I got it :D
- 04-03-2009, 04:13 AM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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
-
One last quick question
By jigglywiggly in forum New To JavaReplies: 7Last Post: 01-26-2009, 08:53 AM -
Quick Question
By Graeme in forum New To JavaReplies: 4Last Post: 01-08-2009, 08:01 PM -
Quick Question
By Spenc in forum New To JavaReplies: 3Last Post: 09-22-2008, 02:26 PM -
quick easy question
By jmHoekst in forum New To JavaReplies: 1Last Post: 06-19-2008, 03:28 PM -
Quick question about sorting
By nbd223 in forum New To JavaReplies: 10Last Post: 04-28-2008, 09:11 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks