Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.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中动态调整luxor(XUL)按钮的大小_Java_Swing_Xul - Fatal编程技术网

JAVA中动态调整luxor(XUL)按钮的大小

JAVA中动态调整luxor(XUL)按钮的大小,java,swing,xul,Java,Swing,Xul,我在.xul文件中定义了一个按钮,如下所示: <button icon="PASTE" id="crew" label="Add crew" command="add_crew"/> 稍后在我的.java文件(在refresh方法中)中,我希望实现this.CREW按钮中的文本根据if语句进行更改 String html; if (this.DJ == true){ html = "<html>" + this.getLang("add_

我在.xul文件中定义了一个按钮,如下所示:

<button icon="PASTE" id="crew" label="Add crew" command="add_crew"/>
稍后在我的.java文件(在refresh方法中)中,我希望实现this.CREW按钮中的文本根据if语句进行更改

    String html;
    if (this.DJ == true){
        html = "<html>" + this.getLang("add_dj").replaceAll("\n", "<br/>") + "</html>";
    }else{
       html = "<html>" + this.getLang("add_crew").replaceAll("\n", "<br/>") + "</html>"; 
    }

    this.CREW.setText(html);
stringhtml;
if(this.DJ==true){
html=“”+this.getLang(“add_dj”).replaceAll(“\n”,“
”)+”; }否则{ html=“”+this.getLang(“添加船员”).replaceAll(“\n”,“
”)+”; } this.CREW.setText(html);
其中getLang(“添加dj”)返回“添加dj”,getLang(“添加船员”)返回“添加船员”。当然,我希望这个文本在多行中,我希望我的按钮能够根据它包含的文本调整大小

this.CREW = (JButton)this.form.getElementById("crew").getJComponent();
    String html;
    if (this.DJ == true){
        html = "<html>" + this.getLang("add_dj").replaceAll("\n", "<br/>") + "</html>";
    }else{
       html = "<html>" + this.getLang("add_crew").replaceAll("\n", "<br/>") + "</html>"; 
    }

    this.CREW.setText(html);