KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > rero > dck > items > LabelInput


1 package rero.dck.items;
2
3 import java.awt.*;
4 import java.awt.event.*;
5
6 import javax.swing.*;
7 import javax.swing.event.*;
8
9 import rero.dck.*;
10
11 public class LabelInput extends JPanel implements DItem
12 {
13    protected JTextPane label;
14
15    public LabelInput(String JavaDoc text, int width)
16    {
17       setLayout(new BorderLayout());
18
19       label = new JTextPane();
20       label.setText(text);
21       label.setBorder(null);
22       label.setOpaque(false);
23       label.setEditable(false);
24       
25       add(label, BorderLayout.CENTER);
26      
27       JPanel gap = new JPanel();
28       gap.setPreferredSize(new Dimension(width, 0));
29       add(gap, BorderLayout.EAST);
30
31       gap = new JPanel();
32       gap.setPreferredSize(new Dimension(width, 0));
33       add(gap, BorderLayout.WEST);
34    }
35
36    public void setEnabled(boolean b)
37    {
38    }
39
40    public void save()
41    {
42
43    }
44
45    public void refresh()
46    {
47    }
48
49    public int getEstimatedWidth()
50    {
51       return 0;
52    }
53
54    public void setAlignWidth(int width)
55    {
56    }
57
58    public void setParent(DParent parent)
59    {
60       
61    }
62
63    public void setText(String JavaDoc text)
64    {
65       label.setText(text);
66    }
67
68    public JComponent getComponent()
69    {
70       return this;
71    }
72 }
73
74
Popular Tags