JBs | Hop, voila mon code (ya qques test encore qui figure dedans mais ils n'ont pas été concluants)
Code :
- public MCQ_Editing(String id)
- {
- gbc = new GridBagConstraints();
- super.setLayout(new GridBagLayout());
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.anchor = GridBagConstraints.EAST;
- super.id = id;
- answers = new Vector();
-
- UpperPane = new JPanel();
- QuestionPane = new JPanel();
-
- //Configuration of the Upper Panel
- UpperPane.setLayout(new GridLayout(3,1));
- UpperPane.setPreferredSize(new Dimension(600,60));
- UpperPane.add(label);
- UpperPane.add(text);
- UpperPane.add(answerlabel);
- super.add(UpperPane, gbc);
-
- //Config. of the Middle Panel (Questions)
- QuestionPane.setLayout(new GridBagLayout());
- QuestionPane.setPreferredSize(new Dimension(600,350));
- QuestionPane.setAlignmentX(0);
- QuestionPane.setAlignmentY(0);
-
- gbd = new GridBagConstraints();
- gbd.gridx = 0;
- gbd.gridy = 0;
- gbd.fill = GridBagConstraints.HORIZONTAL;
- gbd.anchor = GridBagConstraints.EAST;
- gbc.fill = GridBagConstraints.BOTH;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- gbc.gridy++;
- super.add(QuestionPane, gbc);
-
-
-
- }
- public void addAnswer(String id, String text, int num_quest) {
-
- //We Display a Text Edit Area
- CheckBox toAdd = new CheckBox(id, text);
- answers.add(toAdd);
- gbd.gridy++;
- //super.add(new JLabel(num_quest+". " ),gbc);
- QuestionPane.add(new JLabel(num_quest+". " ), gbd);
- gbd.gridx++;
- QuestionPane.add(toAdd, gbd);
- gbd.gridx = 0;
- }
|
|