Reputation: 10778
try this and the label is not visible. Any help on styling components?
public void start() {
if(current != null){
current.show();
return;
}
Form hi = new Form("Hi World");
Component label = new Label();
Style styleLabel= new Style();
styleLabel.setPadding(Component.RIGHT, 10);
styleLabel.setPadding(Component.TOP, 10);
styleLabel.setPadding(Component.LEFT, 10);
styleLabel.setMargin(Component.LEFT, 10);
label.setSelectedStyle(styleLabel);
label.setUnselectedStyle(styleLabel);
hi.addComponent(label);
hi.show();
}
Upvotes: 1
Views: 314
Reputation: 52760
Giving the label text or an icon would help... This has nothing to do with the style. e.g.:
Component label = new Label("Hi");
FYI, its better to style as:
label.getUnselectedStyle().setPadding(Component.RIGHT, 10);
Rather than allocating your own Style
object. There are some "niche" complexities in that approach especially when reusing the Style
object.
Upvotes: 2