OSX not placing windows of Swing application in a sensible location

Paul Taylor paul_t100 at fastmail.fm
Tue Oct 9 02:40:02 PDT 2012


On 05/10/2012 13:30, Anthony Petrov wrote:
> Please file a bug at http://bugs.sun.com/
>
> -- 
> best regards,
> Anthony
Bugs submitted (funny that the url is sun and bugs.oracle.com doesnt exist)

Whilst waiting for it to be confirmed, here is the test case FYI

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class Test
{
     public static void main(final String[] args) throws Exception
     {
         setupScreen();
     }


     public static void setupScreen() throws Exception
     {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
         JFrame frame = new JFrame("test");
         JButton button = new JButton("go");
         button.addActionListener(
                 new ActionListener()
                 {
                     @Override
                     public void actionPerformed(ActionEvent e)
                     {
                         JDialog dialog = new JDialog();
                         dialog.add(new JTextArea(20,20));
                         dialog.pack();
                         dialog.setVisible(true);
                     }
                 }
         );
         frame.setLocationByPlatform(true);
         frame.add(button);
         frame.pack();
         frame.setVisible(true);
     }
}


More information about the macosx-port-dev mailing list