如何在 Vaadin 组件上设置边框? [英] How to set a border on a Vaadin component?

查看:35
本文介绍了如何在 Vaadin 组件上设置边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式在 Java 中为 Form 组件设置边框.如何在无需编辑 css 样式表的情况下执行此操作?

I would like to programmatically set a border around a Form component in Java. How can I do this without having to edit the css style sheet?

推荐答案

您可以使用已经定义边框的 Panel 组件包装表单.否则,除了使用 CSS 之外,别无选择.

You could wrap the form with a Panel component, which has a border defined already. Otherwise, not much alternatives than just using CSS.

如果您希望留在服务器环境中,一种选择是使用 CSSInject 附加组件并使用它添加边框(您仍然需要编写 CSS,但您可以在服务器上的 Java 文件中执行此操作)而不是在常规 CSS 文件中).

One option, if you wish to stay inside the server environment, is to use the CSSInject add-on and add the border using that (you still need to write CSS, but you can do it on the server in a Java file and not inside a regular CSS file).

这篇关于如何在 Vaadin 组件上设置边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆