Files
oop/finalproject/Question12/ViewSimple.java

30 lines
596 B
Java

/*
* Author: CHEN Yongyuan (Walter) 1930006025 from OOP(1007)
* Date: 2022-04-25
*/
import javax.swing.JLabel;
public class ViewSimple extends View<ControllerSimple> {
private JLabel label;
public ViewSimple(Library m, ControllerSimple c) {
super(m, c);
// window
this.setTitle("View Simple");
this.setSize(300, 200);
// conponent
label = new JLabel("Total number of borrowed books: " + m.totalBorrowedBooks());
add(label);
// final
this.setVisible(true);
}
public void update() {
label.setText("Total number of borrowed books: " + m.totalBorrowedBooks());
}
}