1
I am creating a program with MVC rules in Java and would like to know how to create an Event in JLabel
for when I click on it with the mouse.
For example, for the buttons I do so:
View class:
void addLogarListener(ActionListener cal) {
btnLogar.addActionListener(cal);
}
Controller class:
view.addLogarListener(new LogarListener());
//===================================
class LogarListener implements ActionListener {
public void actionPerformed(ActionEvent evento) {
//Comandos
}
}
swing? If it is he already works with this concept. I think it’s silly to go around creating something that java already does to make our life easier.
– user28595
But in MVC it would not be done differently?
– Guilherme Souza