I am trying to code very simple Java program - if the shape is fill and click on particular button is made than the message will popup. On the other hand, if the fill is not selected it will show different messages.
fill.addItemListener(new ItemListener());
rect.addActionListener(new ButtonListener());
And the action event I have written is:
private class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
if(e.getSource()==fill) {
if(e.getSource()==rect) {
JOptionPane.showMessageDialog(null,"Shojibur");
}
else {
JOptionPane.showMessageDialog(null,"Checking");
}
}
}
}