如何在GWT中更改DecoratorPanel的颜色?

时间:2022-06-11 20:13:18

I see that it uses png images for the rendering, so I am assuming that means I need to provide my own version of these images, with colors changed appropriately. Where do I put these images, and how do I apply them in the CSS?

我看到它使用png图像进行渲染,所以我假设这意味着我需要提供我自己的这些图像版本,颜色改变得恰当。我在哪里放这些图像,以及如何在CSS中应用它们?

2 个解决方案

#1


2  

OK, so here's the solution.

好的,所以这是解决方案。

  • Go to the GWT Theme Generator
  • 转到GWT主题生成器

  • choose the color you want
  • 选择你想要的颜色

  • choose a name for your style
  • 为你的风格选择一个名字

  • click generate
  • take the jar file it produces, and add it to your classpath
  • 获取它生成的jar文件,并将其添加到类路径中

  • add a reference to the new style in your app.gwt.xml file
  • 在app.gwt.xml文件中添加对新样式的引用

If you're unhappy with using the Theme Generator, or afraid it might disappear one day, just do it once and thereafter hack the contents of the jar file it produces.

如果您对使用主题生成器感到不满意,或者害怕它可能会在某一天消失,那么只需执行一次,然后破解它生成的jar文件的内容即可。

#2


1  

You can use he following code to apply your own CSS style for Decorator panel.

您可以使用以下代码为Decorator面板应用您自己的CSS样式。

 DecoratorPanel panel=new DecoratorPanel();
 panel.setStyleName("decorator-panel");

In your css file you can apply styles to decorator-panel.Using this we can change colour.For image you create one image directory under public directory(the directory which is having your css file) and put your image there.Then in css you can get image.

在您的css文件中,您可以将样式应用于装饰器面板。使用此我们可以更改颜色。对于图像,您在公共目录(具有您的css文件的目录)下创建一个图像目录并将您的图像放在那里。然后在css中可以得到图像。

#1


2  

OK, so here's the solution.

好的,所以这是解决方案。

  • Go to the GWT Theme Generator
  • 转到GWT主题生成器

  • choose the color you want
  • 选择你想要的颜色

  • choose a name for your style
  • 为你的风格选择一个名字

  • click generate
  • take the jar file it produces, and add it to your classpath
  • 获取它生成的jar文件,并将其添加到类路径中

  • add a reference to the new style in your app.gwt.xml file
  • 在app.gwt.xml文件中添加对新样式的引用

If you're unhappy with using the Theme Generator, or afraid it might disappear one day, just do it once and thereafter hack the contents of the jar file it produces.

如果您对使用主题生成器感到不满意,或者害怕它可能会在某一天消失,那么只需执行一次,然后破解它生成的jar文件的内容即可。

#2


1  

You can use he following code to apply your own CSS style for Decorator panel.

您可以使用以下代码为Decorator面板应用您自己的CSS样式。

 DecoratorPanel panel=new DecoratorPanel();
 panel.setStyleName("decorator-panel");

In your css file you can apply styles to decorator-panel.Using this we can change colour.For image you create one image directory under public directory(the directory which is having your css file) and put your image there.Then in css you can get image.

在您的css文件中,您可以将样式应用于装饰器面板。使用此我们可以更改颜色。对于图像,您在公共目录(具有您的css文件的目录)下创建一个图像目录并将您的图像放在那里。然后在css中可以得到图像。