KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > taskblocks > app > ManConfigPanel


1 /*
2  * Copyright (C) Jakub Neubauer, 2007
3  *
4  * This file is part of TaskBlocks
5  *
6  * TaskBlocks is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * TaskBlocks is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */

19
20 package taskblocks.app;
21
22 import java.awt.GridBagConstraints JavaDoc;
23 import java.awt.GridBagLayout JavaDoc;
24
25 import javax.swing.JLabel JavaDoc;
26 import javax.swing.JPanel JavaDoc;
27 import javax.swing.JTextField JavaDoc;
28
29 import taskblocks.modelimpl.ManImpl;
30 import taskblocks.modelimpl.TaskModelImpl;
31
32
33 public class ManConfigPanel extends JPanel JavaDoc {
34
35     JTextField JavaDoc nameTF;
36     ManImpl _man;
37     TaskModelImpl _model;
38
39     public ManConfigPanel(ManImpl man, TaskModelImpl model) {
40         _man = man;
41         _model = model;
42         buildGui();
43     }
44     
45     private void buildGui() {
46         // create components
47
JPanel JavaDoc contentP = this;
48         JLabel JavaDoc nameL = new JLabel JavaDoc("Worker name:");
49         nameTF = new JTextField JavaDoc(15);
50         
51         //layout components
52
contentP.setLayout(new GridBagLayout JavaDoc());
53         GridBagConstraints JavaDoc gc = new GridBagConstraints JavaDoc();
54         
55         // add labels
56
gc.gridx = 0; gc.gridy = 0;
57         gc.fill = GridBagConstraints.NONE;
58         gc.insets.bottom = 5;
59         gc.anchor = GridBagConstraints.EAST;
60         //
61
contentP.add(nameL, gc);
62         
63         // add edit fields
64
gc.gridx++; gc.gridy=0;
65         gc.fill = GridBagConstraints.HORIZONTAL;
66         gc.weightx = 1;
67         gc.insets.left = 8;
68         //
69
contentP.add(nameTF, gc);
70         
71         // set component properties
72
nameTF.setText(_man.getName());
73     }
74
75
76 }
77
Popular Tags