Forums Register Login

Can a panel send events to another panel/applet window?

+Pie Number of slices to send: Send
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!
Have you no shame? Have you no decency? Have you no tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1046 times.
Similar Threads
BEGINNER-URGENT
Calculating size-accordance between Main Panel & Child Panel.
JColorChooser and StyledEditorKit foreground
changing the outfit of the setting knob ofJSliders???
Change color
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:26:36.