Why isn't Label shown when setting setLabelForComponent for a TextField?

110 views Asked by At

There are Label, TextField and a Container in a Form. I set :

...
private Container c = new Container(new BoxLayout(BoxLayout.Y_AXIS));
...
impay30 = new Label("ImpayƩ 30j");
impay30.setUIID("FicheLibelle");
impay30.setPreferredW(LabellargeW);
impay30txt = new TextField();
impay30txt.setMaxSize(50);
impay30txt.addDataChangeListener(this);
VirtualKeyboard.bindVirtualKeyboard(impay30txt, vkNombre);
impay30txt.setLabelForComponent(impay30);
c.addComponent(impay30txt);

But in runtime the TextField are only displayed but the Label are not displayed ! So how to make the Label appear ?

1

There are 1 answers

0
bharath On BEST ANSWER

You have to add impay30 into Container(c). Then only its showing on the screen. impay30 label is associate with impay30txt component when use setLabelForComponent and it will be used for start the ticker of the Label when the Component receives the focus.