Java Reference
In-Depth Information
8.
9. public class TextAnalysisPanel extends JPanel
10. {
11.
private JLabel lastTextLabel;
12.
private JLabel numberOfEsLabel;
13.
private JLabel numberOfTextsLabel;
14.
private JTextField inputField;
15.
private TextAnalysisModel analysisModel;
16.
17.
public TextAnalysisPanel()
18.
{
19.
analysisModel = new TextAnalysisModel();
20.
21.
this .setBackground(Color.yellow);
22.
this .setLayout( new GridLayout(3,2,10,10));
23.
JLabel questionLabel
= new JLabel("Enter text:");
24.
JLabel replyLabel
= new JLabel("Current text:");
25.
JLabel numberTextLabel = new JLabel("No. of Es in current text:");
26.
lastTextLabel
= new JLabel("");
27.
numberOfEsLabel
= new JLabel("--");
28.
inputField
= new JTextField("");
29.
30.
questionLabel.setOpaque( true );
31.
questionLabel.setBackground(Color.black);
32.
questionLabel.setForeground(Color.white);
33.
34.
replyLabel.setOpaque( true );
35.
replyLabel.setBackground(Color.black);
36.
replyLabel.setForeground(Color.white);
37.
38.
numberTextLabel.setOpaque( true );
39.
numberTextLabel.setBackground(Color.black);
40.
numberTextLabel.setForeground(Color.white);
41.
42.
numberOfEsLabel.setOpaque( true );
43.
numberOfEsLabel.setBackground(Color.red);
44.
numberOfEsLabel.setForeground(Color.white);
45.
46.
lastTextLabel.setOpaque( true );
47.
lastTextLabel.setBackground(Color.red);
48.
lastTextLabel.setForeground(Color.white);
49.
50.
this .add(questionLabel);
51.
this .add(inputField);
52.
this .add(replyLabel);
53.
this .add(lastTextLabel);
Search WWH ::




Custom Search