Automatic repaint
I have been making my way through Deitel's How to Program 5e. In chapter 14, Exercise 14.14 is giving me problems. Does anyone know how to have a user-defined subclass of JPanel (that has three JSliders) cause another (separate) JPanel to repaint itself? My testing class, which extends JApplet, can do this with a JButton, but how do I accomplish this so that the tester class will do automatically? Thanks.
How about:
referenceToOtherJPanel.repaint();
Or I suppose you could go further and write some test code that creates an image, gets the Graphics object for the image, calls update(Graphics) on the JPanel being tested, passing it the Graphics object for the image you just created, and then writes the image out to a file, and not have any GUI at all. You could examine the image file with whatever graphics viewer your system provides. This may or may not be more convenient for testing. Not sure if it'll work but it sounds interesting...