Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java CSS自定义按钮?_Java_Css_Frameworks_Vaadin_Vaadin7 - Fatal编程技术网

Java CSS自定义按钮?

Java CSS自定义按钮?,java,css,frameworks,vaadin,vaadin7,Java,Css,Frameworks,Vaadin,Vaadin7,如何定制vaadin的按钮?我试图设置高度和宽度,但不起作用,我试图对齐按钮中心的图像,但也不起作用 我正在试这个 /** css file styles.scss */ .myButton{ width:60px; height:60px; border:none; text-align:center; } /** my button */ Button btnMyButton = new Button(); btnMyButton.s

如何定制vaadin的按钮?我试图设置高度和宽度,但不起作用,我试图对齐按钮中心的图像,但也不起作用

我正在试这个

/** css file styles.scss */
.myButton{
       width:60px;
       height:60px;
       border:none;
       text-align:center;
}

/** my button */
Button btnMyButton = new Button();
btnMyButton.setIcon(new ThemeResource("../icons/myicon.png"));
btnMyButton.addStyleName("myButton");

有什么想法吗?

创建一个只有图标的按钮非常简单。如果你想要悬停效果,它会变得很棘手,因此你应该使用
NativeButton

Button btnLogout = new Button();
btnLogout.setIcon(new ThemeResource("icons/logout.png"));
btnLogout.addStyleName(Reindeer.BUTTON_LINK); // define it as a link button => no borders, just the icon. Every theme has this style-name.
btnLogout.setDescription("Logout"); // set hint

您只想设置高度、宽度和图像?文本不是已经居中了吗?我想设置按钮的高度和宽度,并将图标(图像)居中。是的,我这样做了。有什么办法来划定边界?示例:.v按钮{边框:1px纯黑;}?