Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setEnabled does not work  RSS feed

 
Mike London
Ranch Hand
Posts: 1359
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having a problem in an Applet.
I'm trying to do a JButton.setEnabled(false) from various places in the Applet, but the button will *not* disable programmatically.
The same code in a regular Java application works as expected.
I'm using Swing controls, but have the latest Java plug-in for the browser.
Any ideas why I can't disable the button?
Thanks much for any ideas.
-- Mike
 
Alan Mc
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that after initialisation, you can only change the setEnabled(boolean) value of an element within an actionEvent, or other action. Which I presume you were doing any way?
Al
 
Mike London
Ranch Hand
Posts: 1359
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup I was.
The same code works in a Java Application, but in the applet the button remains enabled.
???
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!