优化字体与布局

liwentao_branch
Teptao 4 months ago
parent 65fa0802ee
commit fff040118a

@ -103,7 +103,7 @@ public class MathApp extends JFrame {
// 设置现代化UI外观
FlatLightLaf.setup();
// 全局UI定制
UIManager.put("Button.arc", 999);
UIManager.put("Button.arc", 15);
UIManager.put("Component.arc", 15);
UIManager.put("ProgressBar.arc", 999);
UIManager.put("TextComponent.arc", 15);

@ -20,10 +20,10 @@ public class ChangePasswordPanel extends JPanel {
GridBagConstraints gbc = new GridBagConstraints();
JLabel titleLabel = new JLabel("修改密码", SwingConstants.CENTER);
titleLabel.setFont(new Font("思源黑体", Font.BOLD, 32));
titleLabel.setFont(new Font("微软雅黑", Font.BOLD, 32));
JLabel infoLabel = new JLabel("新密码需6-10位且包含大小写字母和数字", SwingConstants.CENTER);
infoLabel.setFont(new Font("思源黑体", Font.PLAIN, 12));
infoLabel.setFont(new Font("微软雅黑", Font.PLAIN, 12));
oldPasswordField = new JPasswordField(20);
newPasswordField = new JPasswordField(20);

@ -24,11 +24,11 @@ public class LoginPanel extends JPanel {
passwordField = new JPasswordField(20);
JButton loginButton = new JButton("登录");
loginButton.setFont(new Font("思源黑体", Font.PLAIN, 16));
loginButton.setFont(new Font("微软雅黑", Font.PLAIN, 16));
loginButton.setPreferredSize(new Dimension(120, 40));
JButton registerButton = new JButton("没有账户?立即注册");
registerButton.setFont(new Font("思源黑体", Font.PLAIN, 12));
registerButton.setFont(new Font("微软雅黑", Font.PLAIN, 12));
registerButton.setBorderPainted(false);
registerButton.setContentAreaFilled(false);
registerButton.setFocusPainted(false);
@ -83,7 +83,7 @@ public class LoginPanel extends JPanel {
}
User user = DataPersistence.findUserByEmail(email);
if (user != null && user.verifyPassword(password)||true) {
if (user != null && user.verifyPassword(password)) {
app.setCurrentUserEmail(email);
app.showPanel(MathApp.MAIN_MENU_PANEL);
} else {

@ -24,7 +24,7 @@ public class QuizPanel extends JPanel {
// 顶部面板:进度条和题号
JPanel topPanel = new JPanel(new BorderLayout());
questionLabel = new JLabel("题目 1/" + questionCount + ": ", SwingConstants.LEFT);
questionLabel.setFont(new Font("思源黑体", Font.BOLD, 20));
questionLabel.setFont(new Font("微软雅黑", Font.BOLD, 20));
progressBar = new JProgressBar(0, questionCount);
progressBar.setValue(0);
progressBar.setStringPainted(true);
@ -38,7 +38,7 @@ public class QuizPanel extends JPanel {
optionButtons = new JRadioButton[4];
for (int i = 0; i < 4; i++) {
optionButtons[i] = new JRadioButton();
optionButtons[i].setFont(new Font("思源黑体", Font.PLAIN, 16));
optionButtons[i].setFont(new Font("微软雅黑", Font.PLAIN, 16));
optionsGroup.add(optionButtons[i]);
centerPanel.add(optionButtons[i]);
centerPanel.add(Box.createVerticalStrut(10));
@ -67,7 +67,7 @@ public class QuizPanel extends JPanel {
}
public void displayQuestion(Question question, int currentQuestionIndex, int totalQuestions) {
questionLabel.setText(String.format("题目 %d/%d: %s", currentQuestionIndex + 1, totalQuestions, question.problemStatement()));
questionLabel.setText(String.format("题目 %d/%d: %s", currentQuestionIndex + 1, totalQuestions, question.problemStatement()));
progressBar.setValue(currentQuestionIndex);
java.util.List<String> options = question.options();
for (int i = 0; i < optionButtons.length; i++) {

@ -25,7 +25,7 @@ public class RegisterPanel extends JPanel {
titleLabel.setFont(new Font("思源黑体", Font.BOLD, 32));
emailField = new JTextField(20);
codeField = new JTextField(10);
codeField = new JTextField(11);
getCodeButton = new JButton("获取验证码");
JButton registerButton = new JButton("验证并设置密码");
JButton backButton = new JButton("返回登录");

@ -11,14 +11,14 @@ public class ResultsPanel extends JPanel {
GridBagConstraints gbc = new GridBagConstraints();
JLabel titleLabel = new JLabel("测验完成!", SwingConstants.CENTER);
titleLabel.setFont(new Font("思源黑体", Font.BOLD, 32));
titleLabel.setFont(new Font("微软雅黑", Font.BOLD, 32));
double percentage = (double) score / totalQuestions * 100;
JLabel scoreLabel = new JLabel(String.format("你的得分: %.0f 分", percentage), SwingConstants.CENTER);
scoreLabel.setFont(new Font("思源黑体", Font.PLAIN, 24));
scoreLabel.setFont(new Font("微软雅黑", Font.PLAIN, 24));
JLabel detailsLabel = new JLabel(String.format("(答对 %d 题,共 %d 题)", score, totalQuestions), SwingConstants.CENTER);
detailsLabel.setFont(new Font("思源黑体", Font.PLAIN, 16));
detailsLabel.setFont(new Font("微软雅黑", Font.PLAIN, 16));
JButton againButton = new JButton("返回选择界面");

@ -21,10 +21,10 @@ public class SetPasswordPanel extends JPanel {
GridBagConstraints gbc = new GridBagConstraints();
JLabel titleLabel = new JLabel("设置您的密码", SwingConstants.CENTER);
titleLabel.setFont(new Font("思源黑体", Font.BOLD, 32));
titleLabel.setFont(new Font("微软雅黑", Font.BOLD, 32));
JLabel infoLabel = new JLabel("密码需6-10位且包含大小写字母和数字", SwingConstants.CENTER);
infoLabel.setFont(new Font("思源黑体", Font.PLAIN, 12));
infoLabel.setFont(new Font("微软雅黑", Font.PLAIN, 12));
passwordField = new JPasswordField(20);
confirmPasswordField = new JPasswordField(20);

Loading…
Cancel
Save