View Javadoc

1   /***
2    * Created on Jan 11, 2006, Copyright UC Regents
3    */
4   package org.telscenter.pas.steps.quickEditors.qti.assessment;
5   
6   import info.clearthought.layout.TableLayout;
7   
8   import java.awt.BorderLayout;
9   import java.awt.Dimension;
10  import java.awt.Font;
11  import javax.swing.BorderFactory;
12  import javax.swing.JLabel;
13  import javax.swing.JPanel;
14  
15  /***
16   * @author aperritano
17   *
18   */
19  public class ChoiceHeaderUI extends JPanel {
20  
21  
22  	private JPanel formPanel;
23  
24  	private Font boldFont;
25  
26  
27  	public static double ANSWER_SIZE = .20;
28  	public static double TEXT_SIZE = .70;
29  	
30  	public ChoiceHeaderUI() {
31  		super();
32  		createMainUI();
33  	}
34  
35  	protected void createMainUI() {
36  		this.setLayout(new BorderLayout(0,0));
37  		this.setOpaque(false);
38  		this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
39  		//this.add(createMainArea(),BorderLayout.CENTER);
40  		this.setPreferredSize(new Dimension(1,1));
41  	}
42  	
43  	protected JPanel createMainArea() {
44  		
45  		formPanel = new JPanel();
46  		
47  //		double pref = TableLayout.PREFERRED;
48  //		double fill = TableLayout.FILL;
49  //		double hSpace = 5;
50  //		
51  //		double size[][] = { { ANSWER_SIZE, 2, pref, hSpace, fill, 0, pref// rt
52  //		},
53  //
54  //		{ pref, pref, pref }
55  //
56  //		};
57  //		
58  //		formPanel.setLayout(new TableLayout(size));
59  //		
60  //		
61  //		createHeaderRow(formPanel);
62  //		
63  //		
64  //		
65  //		formPanel.setOpaque(false);
66  //		formPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
67  		
68  		return formPanel;
69  	}
70  	
71  	/***
72  	 * @param formPanel2
73  	 */
74  	protected void createHeaderRow(JPanel headerPanel) {
75  		
76  		JLabel correctLabel = new JLabel("Answer");
77  		boldFont = correctLabel.getFont().deriveFont(Font.BOLD);
78  		correctLabel.setFont(boldFont);
79  		correctLabel.setHorizontalAlignment(JLabel.CENTER);
80  		
81  		headerPanel.add(correctLabel, "0,0");
82  		
83  		
84  		JLabel choicesLabel = new JLabel(" ");
85  		choicesLabel.setFont(boldFont);
86  		choicesLabel.setHorizontalAlignment(JLabel.CENTER);
87  		
88  		headerPanel.add(choicesLabel, "4,0");
89  
90  		
91  	}	
92  }