-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewAddFillBlankQuestionTab.java
117 lines (96 loc) · 3.47 KB
/
ViewAddFillBlankQuestionTab.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
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 ViewAddFillBlankQuestionTab extends JPanel {
ViewAddQuestionRightPanel rightPanel;
ViewAddQuestionBottomPanel bottomPanel;
JPanel fillBlankPanel;
JPanel beforeAnswer;
JLabel labelBefore;
JTextField textBefore;
JPanel afterAnswer;
JLabel labelAfter;
JTextField textAfter;
JPanel answer;
JLabel labelAnswer;
JTextField textAnswer;
public ViewAddFillBlankQuestionTab(Controller controller) {
setLayout(new BorderLayout());
/*
* try { fOut = new
* FileOutputStream("C:/Users/TEMP/Desktop/fillBlank.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(); }
*/
rightPanel = new ViewAddQuestionRightPanel();
bottomPanel = new ViewAddQuestionBottomPanel(controller, "FillBlank");
add(rightPanel, BorderLayout.EAST);
add(bottomPanel, BorderLayout.SOUTH);
fillBlankPanel = new JPanel();
// cevaptan oncesi
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 sonrasi
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();
labelAnswer = new JLabel(" Enter Answer:");
textAnswer = new JTextField(35);
answer.setBorder(BorderFactory.createTitledBorder("Answer"));
answer.setPreferredSize(new Dimension(500, 150));
answer.add(labelAnswer);
answer.add(textAnswer);
fillBlankPanel.add(beforeAnswer);
fillBlankPanel.add(answer);
fillBlankPanel.add(afterAnswer);
add(fillBlankPanel, BorderLayout.CENTER);
}
// || textAnswer.getText().length() != 0
/*
* @Override public void actionPerformed(ActionEvent e) { if
* (textAnswer.getText().length() != 0) { if (textAnswer.getText().charAt(0)
* != ' ') { GrammarFillBlankQuestion q = new GrammarFillBlankQuestion(
* rightPanel.getTag(), textAnswer.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"); } }
*/
public ViewAddQuestionRightPanel getRightPanel() {
return rightPanel;
}
public JTextField getTextBefore() {
return textBefore;
}
public JTextField getTextAfter() {
return textAfter;
}
public JTextField getTextAnswer() {
return textAnswer;
}
}