Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Technology Project and PMC » SWT_AWT Swing Dialog Problem
SWT_AWT Swing Dialog Problem [message #593782] Tue, 20 May 2003 06:08
MorPheus is currently offline MorPheusFriend
Messages: 57
Registered: July 2009
Member
Hi,

I used SWT_AWT Bridge and created a panel.Into the panel I have added a
swing Button and I have added actionlistener for that button.Using this
event Handling mechanism I have written code such that Whenever the Button
is clicked a swing JOptionPane Dialog will be shown.

The code works correctly and displays a JOptionPane Dialog but when I click
the O.k Button in the JOptionPane Dialog the application hangs.I, thought
that the problem could be because of the fact that SWT and Swing run in
different threads.So I wrapped the code in asyncExec(Runnable).But I Still
Face the same problem.How to solve this problem.



//Snippet

public void createPartControl(final Composite parent)

{

final Panel panel = SWT_AWT.new_Panel(parent);

JButton button = new JButton("Click Me");

panel.add(button);

button.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{


JOptionPane.showInputDialog(parent,"Welcome");

}


}

);

}



//Snippet

(or)



//Snippet

public void createPartControl(final Composite parent)

{

final Panel panel = SWT_AWT.new_Panel(parent);

JButton button = new JButton("Click Me");

panel.add(button);

button.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{


Display.getDefault().asyncExec(new Runnable()

{

public void run()

{

JOptionPane.showInputDialog(parent,"Welcome");


}

}

}


}

);

}



//Snippet

MorPheus
Previous Topic:SWT_AWT Swing Dialog Problem
Next Topic:Working Sets and Runtime configurations?
Goto Forum:
  


Current Time: Fri Apr 26 10:13:19 GMT 2024

Powered by FUDForum. Page generated in 0.03586 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top