Xavier
(Xavier Pan)
1
I’ve a class that extends of class Label:
I would apply a style :
This is the class and css style :
The css code :
.mylabel-center-red{
text-align: center;
font-size:11px;
color:black;
}
The Class that extends Label
public class LabelMessage extends Label {
....
public void applyStyle(){
setStyleName("mylabel-center-red");
}
}
Is something wrong?
Jouni1
(Jouni Koivuviita)
2
Seems correct to me. But I assume it’s not working. Are other custom styles working (in case you have any in your custom theme)?
Xavier
(Xavier Pan)
3
Hi,
Thanks!!
Yes i have other styles in my style.css
For example :
I 've a panel that apply a style :
.v-panel-content-amount {
background-image: url(img/image.gif);
background-repeat:no-repeat;
}
.v-panel-content-amount > div {
background: transparent;
}
And the panel contains the class that extends label that i want apply the style
.mylabel-center-red{
text-align: center;
font-size:11px;
color:red;
}
The screen shows correctly the panel with background image but “my label” continue with black color.
Xavier
(Xavier Pan)
4
This is a test code :
Label label= new Label("Test");
LabelMessage thelabelthatnoworks=new LabelMessage("test",0); //This extends of Label
AbsoluteLayout labelslayout=new AbsoluteLayout();
labelslayout.setWidth("100%");
labelslayout.setWidth("100%");
labelslayout.addComponent(thelabelthatnoworks,"left: 0px; top: 65px;");
labelslayout.addComponent(label,"left: 0px; top: 75px;");
label.setStyleName("mylabel-center-red");
thelabelthatnoworks.setStyleName("mylabel-center-red");
The panel shows correctly label in red but the other (thelabelthatnoworks) continues in black;
Jouni1
(Jouni Koivuviita)
5
Did you ever solve this issue? If not, try increasing the CSS selector priority, by adding additional classnames to it.
E.g.
.v-app .mylabel-center-red {
...
}