jcheckbox がチェックされているかどうかを知る方法を詳しく教えてください。メソッド isSelected が機能しませんでした。実行中に例外が発生します
{
Sandwich = new JButton("Tall");
contentPane.add(Tall);
Sandwitch.setBounds(350, 110, 90,40); //in main
Sandwitch.addActionListener(this);
}
.....
public void actionPerformed(ActionEvent event) {
JButton clickedButton = (JButton) event.getSource();
String buttonText = clickedButton.getText();
..........
if(clickedButton.getText()=="Sandwitch"){
if(Ketchup.getState()&&!Garlic.getState()){//
itm=new Item(""+m+clickedButton.getText(),3.0);
xyz.addItem(itm);
textArea.append(" "+clickedButton.getText()+",");
textArea.append(" "+itm.getPrice()+"\n");}
else if(!Ketchup.isSelected()&&Garlic.isSelected()){//
....................
}
実行中に非常に長い例外が発生します
この問題で私を助けてもらえますか?