我如何禁用 Jlabel?
How do i disable a Jlabel?
这是我当前的代码。我已经在我的代码的最后一行尝试过这个语句和更多的语句。当我 运行 这个 if 语句时,如何禁用 'imagelbl' 标签。*
if(Cardgame.flip == 2){
if(Cardgame.card.equals("aceace")){
Cardgame.score = 1;
String Text = Integer.toString(Cardgame.score);
scorelbl.setText(Text);
Cardgame.flip = 0;
Cardgame.card = ("");
//need to create a statement to disable the icon
imagelbl.setEnable(false);
`myLabel.setEnabled(false)`
仅禁用标签,即标签不再响应用户输入。但是,如果你想隐藏标签,你可以尝试
myLabel.setVisible(false)
应该隐藏图标。
这是我当前的代码。我已经在我的代码的最后一行尝试过这个语句和更多的语句。当我 运行 这个 if 语句时,如何禁用 'imagelbl' 标签。*
if(Cardgame.flip == 2){
if(Cardgame.card.equals("aceace")){
Cardgame.score = 1;
String Text = Integer.toString(Cardgame.score);
scorelbl.setText(Text);
Cardgame.flip = 0;
Cardgame.card = ("");
//need to create a statement to disable the icon
imagelbl.setEnable(false);
`myLabel.setEnabled(false)`
仅禁用标签,即标签不再响应用户输入。但是,如果你想隐藏标签,你可以尝试
myLabel.setVisible(false)
应该隐藏图标。