Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

David Crossett
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class called 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!
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!