Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dialog focus problem on java 7 and mac osx

 
Luis Goncalves
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I'm currently validating a swing application that runs on a browser (on an applets).
I came across with a problem for the java JRE 7 released by Oracle - this was not happening on Applet JRE 6 (1.6.0_33)

Every time I open a dialog within my application, that dialog comes to the front of the browser window but it does not request the focus as expected. THIS HAPPENS ONLY WHEN THE APPLET RUNS ON THE BROWSER.
Here is a small program to show the problem:




To run this code on an applet just create a jar file (let's call it test.jar) from the code. Then create a html file with the following content:



Once you run the html file, you'll see an grey area with a 'open dialog' button. If you press the button, a new dialog comes up with a JTextField and 3 buttons: 'Cancel', 'No' and 'Yes'. The button 'Yes' should be in focus by default, but that is not happening. Plus, even if you click in the JTextField, the field will not get the focus.
Again, this only happen when the applet run on the browser and only for Java 7 (which is the way I need to make it work).
java.vendor Oracle Corporation
java.version 1.7.0_07
os.name Mac OS X
os.version 10.7.4

I used firefox 15 to test this.

Can someone with an applet computer confirm this? Any of you knows how can I solve this?

Thanks in advance
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No idea about your specific problem*, but Applet initialization should be done in init() -- not start(), which is
called after the init method and each time the applet is revisited in a Web page.

Do you really want/need to add a new JPanel with a JButton and set it as the contentPane every time the Applet is revisited?

* edit: because I don't have a Mac, so I can't test nor investigate the behavior.
 
Luis Goncalves
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Darryl
That small program is just to show a problem that happens when you start a dialog from an applet running on the browser.

The actual application I'm validating is much different from this small example and is following the points you mention.

So, the way the applet is initialized is actually not that important. If instead of the start() you have the init() the result on the dialog - where the problem resides - is exactly the same.

I decided to post this problem in the forum in order to other mac users test and confirm this, which I believe is a JRE 7 - mac version - bug.

For those 'only' windows developers: THIS SAME PROBLEM DOES NOT HAPPEN ON WINDOWS.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic