• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to disable components

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I disable AWT checkboxes and scrollbars? I can't seem to find any relevant API.

for example in pesudo code:

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The java.awt.Component class -which all AWT elements extend- has the "setEnabled(boolean)" method, which does exactly that.
 
Jackie Davis
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for that!

Another question, if I have sent a thread to sleep for 10secs.

Thread.sleep(10000)

How do I break out of the sleep if I un-check a checkbox?



Not sure if I use the .notify() method or where to use it.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to hang on to a reference to the thread in question, and then call thread.interrupt(). You should only do this with threads you have created yourself, not with AWT threads that call your paint methods or event handlers. The article referenced in the javadocs for several Thread methods (e.g. Thread.sleep) talks about thread handling in the context of AWT events; that should be helpful reading for what you're doing.
reply
    Bookmark Topic Watch Topic
  • New Topic