Francesca duBois wrote:Here is the PaintPanel() which is where I defined the choices(buttons):
Paul Clapham wrote:
Francesca duBois wrote:Here is the PaintPanel() which is where I defined the choices(buttons):
The following code is difficult to understand. It's clear that g2d is a Graphics object which is being drawn on, but the code doesn't show where it came from. It should really come from the jpCenter component, but presumably it doesn't since you aren't seeing that component updated.
Paul Clapham wrote:It's kind of distracting to have to look at all of that unused code. There's a whole lot of code devoted to ShapeParams, and it looks like it was meant to do something in the past. So it would improve things if you took that out.
But after that, there's a class named Teacher and you're using several of its static variables while trying to get data to appear. Or is that "Teacher" supposed to be a variable? If so, it would help if you followed the Java standards and called it "teacher" instead. Anyway, it would help to know if the "Teacher" there is the same "Teacher" which you used elsewhere. Have you debugged the code to find out if the values you are getting from it are what you expected them to be?
Paul Clapham wrote:Should I assume that "jpCenter" refers to a "PaintPanel" object which is displayed on the screen? And that there aren't any other "PaintPanel" objects?
And you said you debugged that code. Does that mean that you observed the paintComponent method being called and that (for example) Teacher.choice had the value you expected it to have? If not, what did you do instead?
Paul Clapham wrote:And the rectangles and ovals and lines that were drawn on that Graphics object, were they inside the area of the component which was visible on the screen?
Student() can only see the first drawn shape
Norm Radder wrote:
Student() can only see the first drawn shape
Does the Student receive more shapes after the first one? What does it do with the second shape it receives? Is it drawn on the visible GUI like the first one was?
Note: the list of if statements in the paintComponent method appear to be mutually exclusive, ie only one will be true and the others will be false. In that case, the structure of statements should be either a switch statement with a default or a list of if/else if/else statements with an error message in the trailing else so you know when none of the if statements were true.
No after the first one, the Student() does not receive any more
Norm Radder wrote:
No after the first one, the Student() does not receive any more
That implies there is something wrong with the sending and receiving of the shapes between the Teacher and Student. What happens on the Teacher when the second shape is supposed to be sent? Are there any errors? What happens on the Student when the Teacher is sending the second shape?
There are three kinds of actuaries: those who can count, and those who can't.
Teacher stays the same, there is nothing wrong with it, the Student visually stays
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |