-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewAddMultipleChoiceQuestionTab.java
155 lines (128 loc) · 4.5 KB
/
ViewAddMultipleChoiceQuestionTab.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class ViewAddMultipleChoiceQuestionTab extends JPanel {
ViewAddQuestionRightPanel rightPanel;
ViewAddQuestionBottomPanel bottomPanel;
JPanel multipleChoicePanel;
JPanel beforeAnswer;
JLabel labelBefore;
JTextField textBefore;
JPanel afterAnswer;
JLabel labelAfter;
JTextField textAfter;
JPanel answer;
JLabel labelAnswer;
JTextField textAnswer;
JPanel option1;
JLabel labelOption1;
JTextField textOption1;
JPanel option2;
JLabel labelOption2;
JTextField textOption2;
public ViewAddMultipleChoiceQuestionTab(Controller controller) {
/*
* try { fOut=new
* FileOutputStream("C:/Users/TEMP/Desktop/multipleChoice.out"); out=new
* ObjectOutputStream(fOut); } catch (FileNotFoundException e) { // TODO
* Auto-generated catch block e.printStackTrace(); } catch (IOException
* e) { // TODO Auto-generated catch block e.printStackTrace(); }
*/
setLayout(new BorderLayout());
rightPanel = new ViewAddQuestionRightPanel();
bottomPanel = new ViewAddQuestionBottomPanel(controller,
"MultipleChoice");
add(rightPanel, BorderLayout.EAST);
add(bottomPanel, BorderLayout.SOUTH);
multipleChoicePanel = new JPanel();
// cevaptan �ncesi
beforeAnswer = new JPanel();
labelBefore = new JLabel("Enter before answer part:");
textBefore = new JTextField(35);
beforeAnswer.setBorder(BorderFactory
.createTitledBorder("Before Answer"));
beforeAnswer.setPreferredSize(new Dimension(500, 150));
beforeAnswer.add(labelBefore);
beforeAnswer.add(textBefore);
// cevaptan sonras�
afterAnswer = new JPanel();
labelAfter = new JLabel("Enter after answer part:");
textAfter = new JTextField(35);
afterAnswer.setBorder(BorderFactory.createTitledBorder("After Answer"));
afterAnswer.setPreferredSize(new Dimension(500, 150));
afterAnswer.add(labelAfter);
afterAnswer.add(textAfter);
// cevap
answer = new JPanel();
answer.setBorder(BorderFactory.createTitledBorder("Answer"));
answer.setPreferredSize(new Dimension(170, 120));
labelAnswer = new JLabel("Enter Answer:");
textAnswer = new JTextField(10);
answer.add(labelAnswer);
answer.add(textAnswer);
option1 = new JPanel();
option1.setBorder(BorderFactory.createTitledBorder("Option1"));
option1.setPreferredSize(new Dimension(170, 120));
labelOption1 = new JLabel("Enter Option1:");
textOption1 = new JTextField(10);
option1.add(labelOption1);
option1.add(textOption1);
option2 = new JPanel();
option2.setBorder(BorderFactory.createTitledBorder("Option2"));
option2.setPreferredSize(new Dimension(170, 120));
labelOption2 = new JLabel("Enter Option2:");
textOption2 = new JTextField(10);
option2.add(labelOption2);
option2.add(textOption2);
multipleChoicePanel.add(beforeAnswer);
multipleChoicePanel.add(answer);
multipleChoicePanel.add(option1);
multipleChoicePanel.add(option2);
multipleChoicePanel.add(afterAnswer);
add(multipleChoicePanel, BorderLayout.CENTER);
}
public ViewAddQuestionRightPanel getRightPanel() {
return rightPanel;
}
public JTextField getTextBefore() {
return textBefore;
}
public JTextField getTextAfter() {
return textAfter;
}
public JTextField getTextAnswer() {
return textAnswer;
}
public JTextField getTextOption1() {
return textOption1;
}
public JTextField getTextOption2() {
return textOption2;
}
/*
* @Override
*
* public void actionPerformed(ActionEvent e) { if
* (textAnswer.getText().length() != 0 || textOption1.getText().length() !=
* 0 || textOption2.getText().length() != 0) { if
* (textAnswer.getText().charAt(0) != ' ') { GrammarComboBoxQuestion q = new
* GrammarComboBoxQuestion(rightPanel.getTag(), textAnswer.getText(),
* textOption1.getText(), textOption2.getText(), textBefore.getText() +
* " - " + textAfter.getText(), rightPanel.getDif()); if
* (e.getActionCommand().equals("ADD QUESTION")) { try { out.writeObject(q);
* } catch (IOException e1) { // TODO Auto-generated catch block
* e1.printStackTrace(); } } else if
* (e.getActionCommand().equals("PREVIEW QUESTION")) {
* dialog.showedQuestion(q); dialog.setVisible(true); } } else {
* System.out.println("HATA"); } } else { System.out.println("HATA"); } }
*/
}