Answer the question
In order to leave comments, you need to log in
Why does this line not work, in principle, without errors?
Tell me guys. I am learning to build forms in Java: I wrote for the switch
onna.setName(onna.isEnabled()?"1000":"2000");
it seemed to me that in the On position it should be called 1000, but vice versa - 2000. But there is no name at all! Just the button and the icon remained. Everything works, no compiler errors..
------------------------------------ -------------------------------------------------- ------------------------------------------------
This option also passed without errors, but did not give a visual effect:
if (onna.isEnabled())
{
onna.setName("1000");
}
onna.setName("2000");
Answer the question
In order to leave comments, you need to log in
Debugger looked - these functions are generally called? Are they written in the switch event handler?
And the state of the button is changed through setEnabled?
Or are you just poking at it?
Are you using swing
After changing the name, do you call revalidate or repaint?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question