You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
package view;
|
|
import controller.ExamController;
|
|
import javax.swing.*;
|
|
import java.awt.*;
|
|
|
|
public class ResultFrame extends JFrame {
|
|
public ResultFrame(ExamController controller, int score, int total) {
|
|
setTitle("考试结果");
|
|
setSize(250, 150);
|
|
setLocationRelativeTo(null);
|
|
|
|
JPanel panel = new JPanel(new BorderLayout());
|
|
JLabel label = new JLabel("得分: " + score + "/" + total, JLabel.CENTER);
|
|
JButton continueBtn = new JButton("继续做题");
|
|
JButton exitBtn = new JButton("退出");
|
|
|
|
continueBtn.addActionListener(e -> {
|
|
dispose();
|
|
controller.returnToMain();
|
|
});
|
|
|
|
exitBtn.addActionListener(e -> {
|
|
dispose();
|
|
controller.returnToMain();
|
|
});
|
|
|
|
JPanel buttonPanel = new JPanel();
|
|
buttonPanel.add(continueBtn);
|
|
buttonPanel.add(exitBtn);
|
|
|
|
panel.add(label, BorderLayout.CENTER);
|
|
panel.add(buttonPanel, BorderLayout.SOUTH);
|
|
|
|
add(panel);
|
|
setVisible(true);
|
|
}
|
|
} |