I am trying to create a tower of Hanoi Solver that resolves Hanoi without any mouse event. The problem occurs when I move the rectangle to the original residue, even after I paint. I searched the net and tried to change the code but did not work. I am using a JAfLM with JPNel inside it if anything changes.
I have my disk square here which is a rectangle with just color.
Expand the square disk rectangle (color discolver; public disk (int a, int b, int c, int d, color color) {x = a; y = b; width = c ; Height = D; Disk color = color;} Public color getColour () {Change disk color;} Public zero colorware (Graphics G) {repaint (); g.setColor (diskColour); G.fillRect (X, Y, width , Height); Re-coloring ();}} This is my code where I actually call PaintScare method:
public zero Simple Weather (Disk [] disc, int n, graphics g) {disk [n] .setlocation (30,25); disc [n] .paintsquare (g); repaint ();} Painterscreate method paints the disc, while the settling method changes its coordinates. When it runs it is rectangular in the new space, although the old one is still made. Any help is appreciated, Thanks in advance.
You can not reuse in many places.
Paintings A To sort your color grade of top level method and need any other method. Those methods should not be repainted ()
In addition to this, your simple trick disk is really weird that it passes an array of disks, an index, and a graphics object. Instead, take it only in a disc. Just exit the array that is necessary to update. Then whatever the class that calls the simple column, in the same method, make a call to make a separate call instead of painting and updating the model.
Comments
Post a Comment