Quillion
Quillion

Reputation: 6476

SWT and Swing on mac

I can't seem to run SWT and Swing together on a mac.

I understand that to run Swt on a mac I must pass argument -XstartOnFirstThread however that seems to break Swing.

This is a simple snippet that I wrote. None of them create any windows yes, but they use code neccessary for SWT initialization and Swing initialization.

public class Snippet
{
   public static void main(String[] args)
   {

      SwingUtilities.invokeLater(new Runnable()
      {
         @Override
         public void run()
         {
            System.out.println("Muhahahaha");
         }
      });

      Display display = new Display();
      display.dispose();
   }
}

If you execute it with the -XstartOnFirstThread you will observe that the program never finishes executing.

How can I get both of them to run in a harmony and execute to the end?

Thanks to anyone for any help. I spent a week without managing to solve this problem.

Upvotes: 2

Views: 244

Answers (1)

spetrila
spetrila

Reputation: 177

Running Swing and SWT together isn't such a good practice. These two are completely different(logically speaking), and you should choose only one of them to go further with(note that SWT is more customizable and tries to combine the best from AWT and Swing, while Swing is more limited and uses the platform`s native widgets). Perhaps this will help you change your mind.

However, if you are really serious about using them together you should bare in mind that you should not mix them in the same window, and things should be working just fine.

Best of luck!

Upvotes: 1

Related Questions