public static voidqanda(){final JFrame frame=menu(newJFrame());
user.setNickname("zs");
user.setRole(1);
List questions=qandaDao.getQuestions();
JButton jButton_ask=new JButton("Ask Question");
frame.add(jButton_ask);
jButton_ask.setBounds(440, 200, 120, 30);
jButton_ask.addActionListener(newActionListener() {
@Overridepublic voidactionPerformed(ActionEvent e) {//TODO Auto-generated method stub
}
});
JPanel jPanel_qanda=newJPanel();
jPanel_qanda.setPreferredSize(new Dimension(800,150*questions.size()));
jPanel_qanda.setLayout(null);for (int i = 0; i < questions.size(); i++) {
String name=questions.get(i).getName();
String time=questions.get(i).getTime();
String content=questions.get(i).getContent();
JLabel jLabel_name=new JLabel("Name:"+name);
jPanel_qanda.add(jLabel_name);
jLabel_name.setBounds(20, 20+150*i, 60, 20);
JLabel jLabel_time=new JLabel("Time:"+time);
jPanel_qanda.add(jLabel_time);
jLabel_time.setBounds(220, 20+150*i, 160, 20);
JButton jButton_answer=new JButton("Answer");
jPanel_qanda.add(jButton_answer);
jButton_answer.setBounds(420, 20+150*i, 120, 30);
jButton_answer.addActionListener(newActionListener() {
@Overridepublic voidactionPerformed(ActionEvent e) {//TODO Auto-generated method stub
}
});
JButton jButton_check=new JButton("Check");
jPanel_qanda.add(jButton_check);
jButton_check.setBounds(620, 20+150*i, 120, 30);
jButton_check.addActionListener(newActionListener() {
@Overridepublic voidactionPerformed(ActionEvent e) {//TODO Auto-generated method stub
}
});
JTextArea jTextArea_content=newJTextArea(content);
jPanel_qanda.add(jTextArea_content);
jTextArea_content.setBounds(20, 50+150*i, 740, 80);
}
JScrollPane jScrollPane_userInfo=newJScrollPane(jPanel_qanda,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
frame.add(jScrollPane_userInfo);
jScrollPane_userInfo.setBounds(100, 250, 800, 200);
jScrollPane_userInfo.setFont(new Font("Dialog", 0, 20));
}/*** 用户信息*/
public static voiduserInfo(){
JFrame frame=newJFrame();
user.setNickname("zs");
frame.setSize(1000,600);
frame.setVisible(true);
frame.setResizable(false);
frame.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width-400)/2,
(Toolkit.getDefaultToolkit().getScreenSize().height-320)/2);
frame.setTitle("Notice");
frame.setLayout(null);
frame=menu(frame);
List users=userDao.getUsers();
String[][] userInfos=new String[users.size()][4];for(int i=0;i
userInfos[i][0]=users.get(i).getNickname();
userInfos[i][1]=users.get(i).getAccount();
userInfos[i][2]=users.get(i).getEmail();if(users.get(i).getRole()==0){
userInfos[i][3]="Student";
}else{
userInfos[i][3]="Teacher";
}
}
String[] header=new String[]{"Name","Account","Email","Role"};
JTable jTable_userInfo=newJTable(userInfos,header);
JScrollPane jScrollPane_userInfo=newJScrollPane(jTable_userInfo,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
frame.add(jScrollPane_userInfo);
jScrollPane_userInfo.setBounds(100, 200, 800, 200);
jScrollPane_userInfo.setFont(new Font("Dialog", 0, 20));
}