Can a panel send events to another panel/applet window?
posted 12 years ago
I have a class called MyColorChooser...it is 3 JSliders and they are for R, G, B to choose a color by 'seeing' it first. This class also defines a box that shows the color as you manipulate either of the 3 JSliders. The class extends JPanel. Anyway, I put this panel at the bottom of an applet window (using BorderLayout.SOUTH) and then have the applet draw a square on itself. What I want to have happen is to change the color of the fillRect() whenever the color is changed on the 'sub' panel MyColorChooser. How can this be done? The only solution I've seen is to add 3 more JSliders defined IN the applet (kinda shadowing the MyColorChooser class JSliders) and register change listeners for them. That's retarded, as I'm rewriting code that is in the MyColorChooser class. How can I catch an event on a panel (MyColorChooser) and pass it to the JApplet to trigger a redraw (with the appropriate color, which I know how to get - getColor() ). Thank you!
-nothing important to say, but learnin' plenty-