代码之家  ›  专栏  ›  技术社区  ›  rainer

代码名:Eclipse上失去样式的组件之一

  •  2
  • rainer  · 技术社区  · 6 年前

    我正在开发一个使用css插件的应用程序。IDE是Eclipse。

    在访问内部主题编辑器theme.res并进行一些小的实验性更改(与背景无关)后,大多数组件都将其背景更改为白色。

    我已经删除并重新生成了theme.res文件,并禁用了重新启用css支持的功能,但没有任何效果。

    我怎样才能恢复原来的款式?

    ---编辑----

    1. 创建新项目,裸骨;
    2. 增加两个按钮;
    3. 将UIID添加到buttonTwo;
    4. 将材质图标添加到按钮;;
    5. 在CN1-设置中激活css支持;
    6. theme.css中的样式按钮2;

        Form hi = new Form("Hi World", BoxLayout.y());
        FontImage image = FontImage.createMaterial(FontImage.MATERIAL_ADD_BOX, "", 5);
    
        Button buttonOne = new Button("Button One");
        Button buttonTwo = new Button("Button Two");
    
        buttonTwo.setUIID("ButtonTwo");
        buttonOne.setIcon(image);
    
        hi.add(buttonOne).add(buttonTwo);
    
        hi.show();
    

    (CSS样式)

        ButtonTwo {
    
            color: red; 
    
        }
    

    enter image description here

    1 回复  |  直到 6 年前
        1
  •  1
  •   Shai Almog    6 年前

    打开 build.xml -cn1-compile-css 目标。如果没有禁用并重新启用CSS,则刷新文件。

    <java jar="${user.home}/.codenameone/designer_1.jar" failonerror="true">
    

    为此:

    <java jar="${user.home}/.codenameone/designer_1.jar" failonerror="true" fork="true">