Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JApplet UI and threads

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SUN used this snippet to show the corect way to create new UI Swing components. According to SUN this is so that the Milestone events like init, stop etc. will be placed on the event-dispatching thread used by the browser.



If I wanted to add a button, do I insert a new JButton in the createGUI function ?

Also I am developing in Eclipse, and when I create a new Japplet and added a new button component in Eclipse, the code generator does not adhere to the example above. Does this mean that the code generated in Eclipse is not kosher/threadsafe?

ie.


What are the 2 differences in both implementations, and which would you follow in your development?
[ September 16, 2005: Message edited by: sophyan julio ]
 
Bartender
Posts: 9613
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by sophyan julio:


If I wanted to add a button, do I insert a new JButton in the createGUI function ?



Yes.

Originally posted by sophyan julio:

Also I am developing in Eclipse, and when I create a new Japplet and added a new button component in Eclipse, the code generator does not adhere to the example above. Does this mean that the code generated in Eclipse is not kosher/threadsafe?



GUI code generators, for the most part, create very poor code. I have never seen one which creates code that I feel comfortable maintaining.
The code generated by Eclipse COULD be threadsafe, if you jump through the hoops to put the addition of the button to the gui on the swing event thread.


. . . which would you follow in your development?


I follow the Sun example.
 
sophyan julio
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply! i will use less of the VE feature in eclipse ;<
 
It runs on an internal combustion engine. This ad does not:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic