questionpanel.java

来自「java编写的桌面考试系统.含所有源码.」· Java 代码 · 共 43 行

JAVA
43
字号
package exam.gui;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import exam.model.Question;

/**
 * 显示一道试题的面板
 * 
 * @author teacher
 * 
 */
public class QuestionPanel extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3235963662881001526L;
	private JScrollPane jsp;
	private Question question;
	private JTextArea text;

	public QuestionPanel(final Question question) {
		this.question = question;
		text = new JTextArea(100, 56);
		jsp = new JScrollPane(text);
		this.add(jsp);
//		this.add(text);
		init();
	}

	private void init() {
		text.setLineWrap(true);
		text.append(question.getId() + "," + question.getTitle() + "\n");
		text.append("A:" + question.getAnswerA() + "\n");
		text.append("B:" + question.getAnswerB() + "\n");
		text.append("C:" + question.getAnswerC() + "\n");
		text.append("D:" + question.getAnswerD() + "\n");
		text.setEditable(false);
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?