Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
New widget - style inheritance
I've created widget which inherit from VTextField. Everything works ok, but I don't know how to inherit CSS style from VTextField.
public class VTimeField extends VTextField implements Paintable {
public static final String CLASSNAME = "v-timefield";
....some code ommited....
public VTimeField() {
setStyleName(CLASSNAME);
/** maybe addStyleName("v-textfield"); **/
}
....some code ommited....
}
regards Sean
Hello,
rewrite the constructor like this:
public VTimeField() {
addStyleName(CLASSNAME);
}
As VTextfield sets its own css class with "setStyleName" you overwrite these settings again and loose the style information from the original text field.
Just a note: As VTextfield already implements Paintable i think you don't have to implement it again.
Hope that helps,
Marc
Thank you for your reply. Now everything works just like it should.
You have right that I unnecessarily implement interface which was implemented in superclass.
regards Sean