File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Dialog focus problem on java 7 and mac osx Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Dialog focus problem on java 7 and mac osx " Watch "Dialog focus problem on java 7 and mac osx " New topic
Author

Dialog focus problem on java 7 and mac osx

Luis Goncalves
Greenhorn

Joined: Jun 07, 2011
Posts: 4
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

Joined: May 03, 2008
Posts: 4522
    
    5

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.


luck, db
There are no new questions, but there may be new answers.
Luis Goncalves
Greenhorn

Joined: Jun 07, 2011
Posts: 4
@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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dialog focus problem on java 7 and mac osx
 
Similar Threads
Pass data back to Window 1 from Window 2
GUI Design issue
Focus: cant find the relevant method
how to display textfield in a gridbaglayout
Parent/Child Window Communication