my dog learned polymorphism*
The moose likes Applets and the fly likes JApplet UI and threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Applets
Bookmark "JApplet UI and threads" Watch "JApplet UI and threads" New topic
Author

JApplet UI and threads

sophyan julio
Greenhorn

Joined: Sep 16, 2005
Posts: 5
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 ]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8914
    
    8

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
sophyan julio
Greenhorn

Joined: Sep 16, 2005
Posts: 5
thanks for your reply! i will use less of the VE feature in eclipse ;<
 
GeeCON Prague 2014
 
subject: JApplet UI and threads