Aniket_Mishra
Aniket_Mishra

Reputation: 59

how to remove AWT label in window frame

public void itemStateChanged(ItemEvent e)
    {
        text += "Language : ";
        text += "Hindi: " + Hindi.getState();
        text += " English: " + English.getState();
        text += "Maths: " + Maths.getState();
        label.setText("");
        label.setText(text);
    }

this code show new result with previous one i want updated result only not the previous one so how can i remove previous AWT label output from the frame.

Upvotes: 0

Views: 60

Answers (1)

Chocksmith
Chocksmith

Reputation: 1208

just remove the + in the first line of the method.

text = "Language : ";

Please note that the way you are appending Strings is not efficient. Try using String.format() instead.

Upvotes: 2

Related Questions