final project q12 giveup
This commit is contained in:
29
finalproject/Question12/ViewSimple.java
Normal file
29
finalproject/Question12/ViewSimple.java
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user