gen.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String input = key.getText();
if(input.toLowerCase() == "c"){
System.out.println("C major!");
}else{
System.out.println("Invalid!");
}
}
});
Gen is a JButton while key is a JTextField Here I attempt to check the value of key but the output continues to display "Invalid!" I'm not sure if I'm missing something or if there is another approach to this.