Monday 15 June 2015

java - how to remove an action listener? -


So im playing a chess game but with only the knight.

The way to move this knight

  Public Zero Cabello (Last Integer Line, Last Integer Column) {Final Pocket Current = Mesa [row] [ Column]; Current.setIcon (image); Panel.repaint (); Assessment (row, column, current); } Public Zero Acciones (last int row, last int column, final JButton current) {for (int i = 0; i  = 0 & line & lt; HEIGHT & amp; amp; column & gt; = 0 & amp; amp; ; Amp; amp; columns & lt; WIDTH); }}   

My problem is that when I first saw the new knight, I could have already moved it. So I was thinking that if I remove the action list in the implementation of the implementation then I can fix it. What do you think I'm new to Java to forgive, if this is a stupid question

Like Nachok said , You should use: component. Revolutionary Evangelist (Executionist Universalism)

Here you can use it in your e method:

  Public ActionList E (Last Interval Line, Last Pocket Present) {Return to New Actionist () (Action Avenue E) {Current. Set Icon (empty); If (TinBacon (Line + 2, Column + 1) ) {If (e.getSource () == Mesa [row + 2] [column + 1]) {cabello (p) (+ 2, Column + 1);}} If (TinBeckon (Line + 2, Column - 1)) {if (e.getSource () == Mesa [row + 2] [Column - 1]) {Cabello (line {Caballo (row - 2) 2, column - 1);}} if (tinbackon (line -2, column + 1)) {if (e.getSource () == Mesa [line -2] [column + 1]) {cabalo (line -2 (Column + 1, column + 2) {if (e.getSource () == Mesa [row + 1] [column + 2]) {Cabello (line + 1, Column + 2);}} if (tinbackon (line -1, column + 2 )) {If (e.getSource () == Mesa [Line-1] [Column + 2]) {Cabello (Line-1, Column + 2); }} If (tinbackon (line + 1, column-2)) {if (e.getSource () == Mesa [row + 1] [column2]) {Cabello (line + 1, column - 2); }} If (tinbackon (line-1, column-2)) {if (e.getSource () == Mesa [row-1] [column-2]) {Cabello (line-1, column-2); }} ((Abbottbutan) E. Tetsource ()). Set-ended (wrong); ((Abbottbutan) e.getSource ()). Delete Action Listener (this); }}; }   

I see that you are new to Java, you will see that I have made a few changes to your e system, only to call current.setIcon (null); and (Abbotsbutton) E.Tetsource ()). Set anted (false); I have also made sure that the action listener is called only once, you can write duplicate code as possible.

No comments:

Post a Comment