SWT AWT bridge [message #511695] |
Tue, 02 February 2010 09:56  |
Eclipse User |
|
|
|
Hi all,
I'm using the bridge awt swt to work with JXMapKit.
When I use JXMapKit in a swing component like a JFrame I can manage the zoom with the wheel in the mouse.
If I move this compnent to the bridge this event is lost.
I simplify my code and I did the same test with a button in a panel. The result was the same. The event mouse wheel is fired only when I use JFrame and is not fired with the bridge.
The next code made with swing works:
JPanel panel = new JPanel();
JButton button = new JButton();
button.setText( "moves the wheel" );
button.addMouseWheelListener( new MouseWheelListener() {
@Override
public void mouseWheelMoved( MouseWheelEvent e )
{
System.out.println("wheel moved");
}
});
panel.add( button, BorderLayout.CENTER );
JFrame frame = new JFrame( "title" );
frame.add( panel );
frame.pack();
frame.setVisible( true );
The next code made using the bridge in a view doesn't work:
public void createPartControl(final Composite parent) {
Composite composite = new Composite(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
composite.setLayout( new MigLayout("wrap 1, fillx") );
composite.setLayoutData( "pushx, growx" );
java.awt.Frame frame = SWT_AWT.new_Frame(composite);
JPanel panel = new JPanel( new BorderLayout() );
frame.add( panel );
JButton button = new JButton();
button.setText( "moves the wheel" );
button.addMouseWheelListener( new MouseWheelListener() {
@Override
public void mouseWheelMoved( MouseWheelEvent e )
{
System.out.println("wheel moved");
}
});
panel.add( button, BorderLayout.CENTER );
|
|
|
Re: SWT AWT bridge [message #511719 is a reply to message #511695] |
Tue, 02 February 2010 11:02  |
Eclipse User |
|
|
|
Hi,
It looks like you're seeing
https://bugs.eclipse.org/bugs/show_bug.cgi?id=261764 . I would suggest
CC'ing yourself to this report in order to be notified of its progress. I
don't know of a workaround to suggest.
Grant
"David Crecente" <david.crecente@gmail.com> wrote in message
news:hk9ef8$gms$1@build.eclipse.org...
> Hi all,
> I'm using the bridge awt swt to work with JXMapKit.
>
> When I use JXMapKit in a swing component like a JFrame I can manage the
zoom with the wheel in the mouse.
> If I move this compnent to the bridge this event is lost.
>
> I simplify my code and I did the same test with a button in a panel.
The result was the same. The event mouse wheel is fired only when I use
JFrame and is not fired with the bridge.
> The next code made with swing works:
> JPanel panel = new JPanel();
> JButton button = new JButton();
> button.setText( "moves the wheel" );
> button.addMouseWheelListener( new MouseWheelListener() {
>
> @Override
> public void mouseWheelMoved( MouseWheelEvent e )
> {
> System.out.println("wheel moved");
>
> }
> });
> panel.add( button, BorderLayout.CENTER );
>
> JFrame frame = new JFrame( "title" );
> frame.add( panel );
>
> frame.pack();
> frame.setVisible( true );
>
> The next code made using the bridge in a view doesn't work:
> public void createPartControl(final Composite parent) {
> Composite composite = new Composite(parent, SWT.EMBEDDED |
SWT.NO_BACKGROUND);
> composite.setLayout( new MigLayout("wrap 1, fillx") );
> composite.setLayoutData( "pushx, growx" );
> java.awt.Frame frame = SWT_AWT.new_Frame(composite);
> JPanel panel = new JPanel( new BorderLayout() );
> frame.add( panel );
> JButton button = new JButton();
> button.setText( "moves the wheel" );
> button.addMouseWheelListener( new MouseWheelListener() {
>
> @Override
> public void mouseWheelMoved( MouseWheelEvent e )
> {
> System.out.println("wheel moved");
>
> }
> });
> panel.add( button, BorderLayout.CENTER );
>
>
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02733 seconds