• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

JApplet UI and threads

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply! i will use less of the VE feature in eclipse ;<
 
Evildoers! Eat my justice! And this tiny ad's justice too!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic