如何为PropertyBusinessObject名称绑定的Label设置样式?
如何为PropertyBusinessObject绑定的内置Label设置样式?
我需要为PropertyBusinessObject名称绑定的内置Label及TextField单独设置样式,不想给应用中所有Label套用相同样式。如果无法实现按表单单独设置样式,我只能打破绑定,手动创建单个Label。
目前我手动创建的TextField样式设置正常,示例代码如下:
TextField line1Tf = new TextField("", " ", 30, TextField.ANY); line1Tf.setUIID("textfieldLarge"); uib.bind(pr.line1, line1Tf); h1.add(pr.line1.getLabel()).add(line1Tf); resp.add(h1);
编辑1
我按照建议添加了Label样式设置代码:
TextField line1Tf = new TextField("", " ", 30, TextField.ANY); line1Tf.setUIID("textfieldLarge"); uib.bind(pr.line1, line1Tf); pr.line1.getLabel().setUIID("textLarge"); h1.add(pr.line1.getLabel()).add(line1Tf); resp.add(h1);
但调用setUIID()时提示**“Cannot find symbol”**错误,即使将构造函数移到类的顶层,错误依然存在。
编辑2
我转而尝试为Contact(Players)表单设置样式,该表单完全按照public Container createManualContactEditorContainer(Contact c)方法的结构构建(我调换了Manual和Magical方法的用法),自行定义数据集合的自动构建:
TextField nameTf = new TextField(); nameTf.setUIID("textLarge"); uib.bind(c.name, nameTf); c.name.getLabel().setUIID("Label2"); resp.add(c.name.getLabel()).add(nameTf);
同样遇到了**“Cannot find symbol”**错误。
我还将UIID设置代码移至showContactsList(boolean forward)方法中,在PropertyBusinessObject初始化后执行:
private void showContactsList(boolean forward) { try { Contact c = new Contact(); c.name.getLabel().setUIID("Label2");
错误依旧没有解决。
我现在不知道该在哪里设置UIID,如果找不到自动创建场景下设置UIID的有效方法,只能放弃自动创建方式。
内容的提问来源于stack exchange,提问作者curtjacobs1
相关产品推荐
相关产品推荐

