This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
So the program is supposed to change the fill color of a predetermined shape from slider or text field values. The problem is that my sliders aren't updating from text field values. I've seen several examples of how to specify the event using KeyListner on the web, but my teacher specified that we should be using ActionListner.
I'd appreciate any help.
I apologize for the miscellaneous code. I tend to jump from problem to problem when I get stuck.
You're never changing the colors of the displayed P6PaintPanel.
A few suggestions.
1) The P6PaintPanel added to the JApplet's contentPane has to be visible in the class so that you can change its state (its Color) when desired. This means that you shouldn't create an anonymous object in the add(...) method but rather use the class P6PaintPanel field and don't forget to initialize it.
2) I'd give the P6PaintPanel a public method that allows outside classes to set the Color (or if desired, the redValue, greenValue, and blueValue ints).
3) I'd call this method on the displayed P6PaintPanel object whenever the color changes, and then call repaint() on the JPanel (or you could have repaint() be part of the setColor(...) method.