I'm super confused with what exactly models are supposed to do in java swing. At present I'm basically trying to create a model for JButton to detect if it isPressed(); My essential goal of the model is to do something like this:

```
if(myButton.isPressed() ) {
    myButton.setBackground(Color.RED);
}
else{//when any other button is pressed?
    myButton.setBackground(Color.WHITE);
}

```

At present my code is something like this:

```
    numberButton = new JButton("Num");
    numberButton.setBounds(20,40,80,30);
    numberButton.addChangeListener(new ChangeListener() {
        public void stateChanged (ChangeEvent e){
           if (model.isPressed() ){
              doColorChange(model);
           }
        }
    });

```

I understand that this is totally wrong, but I have no idea where, and I haven't found a tutorial that really explains what I'm doing wrong or why I need a model for this at all.

Please help me restore my sanity! Thanks a lot!