Janny Will

Greenhorn
+ Follow
since Apr 12, 2017
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Janny Will

**Edited

public void mouseMoved(MouseEvent event) {

   Point mousePoint = event.getPoint();
   for(Point point : specialPointList) {
       if(mousePoint.equals(point)) {
           lightUpAPoint(point);
       }
   }
}
8 years ago
Would this work?

8 years ago
One one of my homework questions, I got this one marked wrong and I still can't seem to figure out how to solve it. Was I missing a loop or a condition?

The question was as stated:
You have a GUI that keeps track of a list of pre-specified "special" points. If the user's mouse moves over one of these points, the point lights up. Write the code that would go inside of the handler/listener below. Use the references and also assume the existence of the method listed below (which you can invoke- you do not need to write).

--specialPointList // an ArrayList of the pre-specified "special" points; the type is ArrayList<Point>
--assume this method exists: public void lightUpAPoint(Point p)

Your code will go inside the handler method:


This was my answer:
8 years ago
Thank you for the suggestions! I guess I am just trying to understand my professors example if how she first read the file but it was never explained. Is there a simpler or more beginner way of writing the for loop in her code? Because I can't seen to trace what she was trying to do making it difficult to understand.

This is how her code starts out...
8 years ago
Hello:)) I am a newbie to this forum as well as Java... My task is to write a Hangman program that requires exception handling and I am not sure how to begin. Specifically, how do I read in a list of words in a text file and randomly choose a word from it?

This is what I have so far...
8 years ago