📄 answer.java
字号:
import java.util.Vector;
public class Answer extends javax.swing.JFrame {
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private Vector aVector;
public Answer(Vector V,String s) {
aVector=V;
initComponents(s);
}
private void initComponents(String s) {
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
if(s.equals("1"))
{
for(int i=0;i<aVector.size();i++)
{
Grade aGrade=(Grade)aVector.elementAt(i);
jTextArea1.append(aGrade.getCourse1()+" "+aGrade.getCourse2()+" "+aGrade.getCourse3()+"\n");
}
}
else if(s.equals("2"))
{
for(int i=0;i<aVector.size();i++)
{
Grade aGrade=(Grade)aVector.elementAt(i);
jTextArea1.append(aGrade.getCourse4()+" "+aGrade.getCourse5()+" "+aGrade.getCourse6()+" "+aGrade.getCourse7()+"\n");
}
}
else if(s.equals("3"))
{
for(int i=0;i<aVector.size();i++)
{
Grade aGrade=(Grade)aVector.elementAt(i);
jTextArea1.append(aGrade.getCourse1()+" "+aGrade.getCourse2()+" "+aGrade.getCourse3()+" "+aGrade.getCourse4()+" "+aGrade.getCourse5()+"\n");
}
}
else if(s.equals("4"))
{
for(int i=0;i<aVector.size();i++)
{
Grade aGrade=(Grade)aVector.elementAt(i);
jTextArea1.append(aGrade.getCourse4()+" "+aGrade.getCourse5()+" "+aGrade.getCourse6()+" "+aGrade.getCourse7()+"\n");
}
}
else if(s.equals("5"))
{
for(int i=0;i<aVector.size();i++)
{
Grade aGrade=(Grade)aVector.elementAt(i);
jTextArea1.append(aGrade.getCourse1()+" "+aGrade.getCourse2()+" "+aGrade.getCourse3()+" "+aGrade.getCourse4()+" "+aGrade.getCourse5()+"\n");
}
}
jScrollPane1.setViewportView(jTextArea1);
jLabel1.setText("\u67e5\u8be2\u7ed3\u679c\u5982\u4e0b:");
jButton1.setText("退出");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 114, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(184, Short.MAX_VALUE))
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap(186, Short.MAX_VALUE)
.add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 92, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(20, 20, 20))
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 341, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
);
pack();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
this.dispose();
}
/*
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Answer().setVisible(true);
}
});
}
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -