SWT_AWT Swing Dialog Problem [message #54233] |
Tue, 20 May 2003 02:08 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02998 seconds