I've got this section of code.
- Code: Select All Code
public void actionPerformed(ActionEvent event) {
// TODO Auto-generated method stub
String state = event.getActionCommand();
Log.Logging(this.getClass().getName(), ""+state);
if(newGameString == state){Center.texyTextAdderCenter(state, false, true);}
if(saveGameString == state){Center.texyTextAdderCenter(state, false, true);}
if(loadGameString == state){Center.texyTextAdderCenter(state, false, true);}
if(optionsString == state){Center.texyTextAdderCenter(state, false, true);}
if(quitString == state){Center.texyTextAdderCenter(state, false, true);}
else {
Center.texyTextAdderCenter("What the F did you do? This is a bug and needs to be reported!... Like now.", false, true);
Center.texyTextAdderCenter("I need you to go to LoK forums or my blog and post this third line in a comment or something that I can read.", false, true);
Center.texyTextAdderCenter(event+"", false, true);
Center.texyTextAdderCenter("Again, how the hell did you do this? My if statement logic leaves no room for error so how the hell did you trigger the else statement?", false, true);
}
}
}
Here's the problem, when ever my action listener fires (the thing above.) it will compare the values just fine, but, the else statement will also fire. I'm getting results like
- Code: Select All Code
New Game
What the F did you do? This is a bug and needs to be reported!... Like now.
I need you to go to LoK forums or my blog and post this third line in a comment or something that I can read.
java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=New Game,when=1334556942200,modifiers=Button1] on javax.swing.JMenuItem[,1,3,85x21,invalid,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.metal.MetalBorders$MenuItemBorder@360be0,flags=264,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=2,bottom=2,right=2],paintBorder=true,paintFocus=false,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=New Game]
Again, how the hell did you do this? My if statement logic leaves no room for error so how the hell did you trigger the else statement?
from one click.