Home » Eclipse Projects » Standard Widget Toolkit (SWT) » cursor set incorrectly for JSplitPane with SWT embedded swing
cursor set incorrectly for JSplitPane with SWT embedded swing [message #451928] |
Fri, 11 March 2005 10:22 |
Klemens Hemm Messages: 1 Registered: July 2009 |
Junior Member |
|
|
The swing cursor for the divider of a JSplitPane is displayed at the
wrong location when embedding swing into SWT.
As described in the old news entry below, the cursor pops up at the
funny place measured from screen(0,0).
This problem still exists with current eclipse (3.0.1, 3.1.0.M5) and
java versions (1.4.2_07, 1.5.0_01)
Does anyone know a workaround ?
Klemens
* From: "Steve Northover" <steve_northover@xxxxxxxxxx>
* Date: Wed, 24 Mar 2004 15:03:50 -0500
* Newsgroups: eclipse.platform.swt
* Organization: EclipseCorner
>Please enter a problem report with each one of these issues and a >snippet
>that shows the problem. The flashing I have seen before but determined
>(possibly incorrectly) that the problem was in Swing.
"Philippe Riand" <phil@triloggroup.com> wrote in message
c3s8nn$qr$1@eclipse.org">news:c3s8nn$qr$1@eclipse.org...
> I'm currently experiencing the new SWT_AWT while porting our development
> studio to Eclipse. I'm using M7 & JDK 1.4.2.
> I found the following problems:
>
> 1/ I need a listener on the SWT Composite to resize the underlying Swing
> component. Else, the swing component is not resized!
> Here is the code I use to add the component. I added an intermadiate
panel,
> as I saw on other threads that swing components may not receive mouse
events
> when directly added to the Frame.
> javax.swing.JComponent component = <get my swing control method>;
> final java.awt.Frame statusFrame = SWT_AWT.new_Frame(parent);
> final java.awt.Panel pnl = new java.awt.Panel();
>
> statusFrame.setLayout(new java.awt.BorderLayout());
> statusFrame.add(pnl,java.awt.BorderLayout.CENTER);
>
> pnl.setLayout(new java.awt.BorderLayout());
> pnl.add(component,java.awt.BorderLayout.CENTER);
>
> statusFrame.add(component,java.awt.BorderLayout.CENTER);
> parent.addListener(SWT.Resize, new Listener() {
> public void handleEvent(Event e) {
> Rectangle rect = parent.getClientArea();
> statusFrame.setSize(rect.width, rect.height);
> statusFrame.validate();
> }
> });
>
> 2/ I'm systematically gettting a NullPointerException when a swing based
> editor is closed.
> In fact, it seems that the awt component is still receiving events while
the
> editor is already closed (the Composite is disposed). Here is the
exception
> I get:
> Thread [AWT-EventQueue-0] (Suspended (exception NullPointerException))
> Win32BlitLoops.Blit(SurfaceData, SurfaceData, Composite, Region, int,
int,
> int, int, int, int) line: not available [native method]
> DrawImage.blitSurfaceData(SunGraphics2D, SurfaceData, SurfaceData,
> SurfaceType, SurfaceType, int, int, int, int, int, int, Color) line: 640
> DrawImage.renderSurfaceData(SunGraphics2D, SurfaceData, Color, int, int,
> int, int, int, int) line: 346
> DrawImage.copyImage(SunGraphics2D, Image, int, int, int, int, int, int,
> Color) line: 66
> DrawImage.copyImage(SunGraphics2D, Image, int, int, Color) line: 50
> DrawImage.copyImage(SunGraphics2D, Image, int, int, Color,
ImageObserver)
> line: 736
> ValidatePipe.copyImage(SunGraphics2D, Image, int, int, Color,
> ImageObserver) line: 147
> SunGraphics2D.drawImage(Image, int, int, Color, ImageObserver) line:
2755
> SunGraphics2D.drawImage(Image, int, int, ImageObserver) line: 2745
> PageEditorPanel(JComponent).paintWithOffscreenBuffer(JCompon ent,
Graphics,
> int, int, int, int, Image) line: 4805
> PageEditorPanel(JComponent).paintDoubleBuffered(JComponent, Component,
> Graphics, int, int, int, int) line: 4748
> PageEditorPanel(JComponent)._paintImmediately(int, int, int, int) line:
> 4692
> PageEditorPanel(JComponent).paintImmediately(int, int, int, int) line:
4495
> RepaintManager.paintDirtyRegions() line: 410
> SystemEventQueueUtilities$ComponentWorkRequest.run() line: 117
> InvocationEvent.dispatch() line: 178
> EventQueue.dispatchEvent(AWTEvent) line: 454
> EventDispatchThread.pumpOneEventForHierarchy(int, Component) line: 201
> EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component)
> line: 151
> EventDispatchThread.pumpEvents(int, Conditional) line: 145
> EventDispatchThread.pumpEvents(Conditional) line: 137
> EventDispatchThread.run() line: 100
>
>
> 3/ The Swing cursor is incorrect
> In fact, it seems that the component positions are incorrectly computed,
as
> the cursor displayed is *not* the cursor assigned to the underlying
> component. Moreover, it seems that it compute the position from absolute
> screen (0,0). In other words, when your using a SplitPane, the vertical
> divider cursor does not appear when the mouse is over the divider, but
when
> the mouse is left to the divider. And it seems that the distance between
> this position and the divider correspond to the left corner of the
embedded
> frame, relative to absolute (0,0)
>
>
> 4/ The editor is flashing
> It seems that the Frame (or some other SWT component?) is painting its
> background before the Swing component paints. As a result, it flashes
with
a
> gray background.
> I don't know how to overcome this.
>
>
> Does anybody have an idea about these issues?
>
> Thanks,
>
> Phil.
>
>
|
|
|
Re: cursor set incorrectly for JSplitPane with SWT embedded swing [message #451947 is a reply to message #451928] |
Fri, 11 March 2005 16:06 |
Veronika Irvine Messages: 1272 Registered: July 2009 |
Senior Member |
|
|
See:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=56170
"Klemens Hemm" <klemens.hemm@empolis.com> wrote in message
news:d0rrh7$mq4$1@www.eclipse.org...
> The swing cursor for the divider of a JSplitPane is displayed at the wrong
> location when embedding swing into SWT.
> As described in the old news entry below, the cursor pops up at the funny
> place measured from screen(0,0).
>
> This problem still exists with current eclipse (3.0.1, 3.1.0.M5) and java
> versions (1.4.2_07, 1.5.0_01)
>
> Does anyone know a workaround ?
>
> Klemens
>
>
> * From: "Steve Northover" <steve_northover@xxxxxxxxxx>
> * Date: Wed, 24 Mar 2004 15:03:50 -0500
> * Newsgroups: eclipse.platform.swt
> * Organization: EclipseCorner
>
> >Please enter a problem report with each one of these issues and a
> > >snippet
> >that shows the problem. The flashing I have seen before but determined
> >(possibly incorrectly) that the problem was in Swing.
>
> "Philippe Riand" <phil@triloggroup.com> wrote in message
> c3s8nn$qr$1@eclipse.org">news:c3s8nn$qr$1@eclipse.org...
> > I'm currently experiencing the new SWT_AWT while porting our development
> > studio to Eclipse. I'm using M7 & JDK 1.4.2.
> > I found the following problems:
> >
> > 1/ I need a listener on the SWT Composite to resize the underlying Swing
> > component. Else, the swing component is not resized!
> > Here is the code I use to add the component. I added an intermadiate
> panel,
> > as I saw on other threads that swing components may not receive mouse
> events
> > when directly added to the Frame.
> > javax.swing.JComponent component = <get my swing control method>;
> > final java.awt.Frame statusFrame = SWT_AWT.new_Frame(parent);
> > final java.awt.Panel pnl = new java.awt.Panel();
> >
> > statusFrame.setLayout(new java.awt.BorderLayout());
> > statusFrame.add(pnl,java.awt.BorderLayout.CENTER);
> >
> > pnl.setLayout(new java.awt.BorderLayout());
> > pnl.add(component,java.awt.BorderLayout.CENTER);
> >
> > statusFrame.add(component,java.awt.BorderLayout.CENTER);
> > parent.addListener(SWT.Resize, new Listener() {
> > public void handleEvent(Event e) {
> > Rectangle rect = parent.getClientArea();
> > statusFrame.setSize(rect.width, rect.height);
> > statusFrame.validate();
> > }
> > });
> >
> > 2/ I'm systematically gettting a NullPointerException when a swing based
> > editor is closed.
> > In fact, it seems that the awt component is still receiving events while
> the
> > editor is already closed (the Composite is disposed). Here is the
> exception
> > I get:
> > Thread [AWT-EventQueue-0] (Suspended (exception NullPointerException))
> > Win32BlitLoops.Blit(SurfaceData, SurfaceData, Composite, Region, int,
> int,
> > int, int, int, int) line: not available [native method]
> > DrawImage.blitSurfaceData(SunGraphics2D, SurfaceData, SurfaceData,
> > SurfaceType, SurfaceType, int, int, int, int, int, int, Color) line: 640
> > DrawImage.renderSurfaceData(SunGraphics2D, SurfaceData, Color, int,
> > int,
> > int, int, int, int) line: 346
> > DrawImage.copyImage(SunGraphics2D, Image, int, int, int, int, int, int,
> > Color) line: 66
> > DrawImage.copyImage(SunGraphics2D, Image, int, int, Color) line: 50
> > DrawImage.copyImage(SunGraphics2D, Image, int, int, Color,
> ImageObserver)
> > line: 736
> > ValidatePipe.copyImage(SunGraphics2D, Image, int, int, Color,
> > ImageObserver) line: 147
> > SunGraphics2D.drawImage(Image, int, int, Color, ImageObserver) line:
> 2755
> > SunGraphics2D.drawImage(Image, int, int, ImageObserver) line: 2745
> > PageEditorPanel(JComponent).paintWithOffscreenBuffer(JCompon ent,
> Graphics,
> > int, int, int, int, Image) line: 4805
> > PageEditorPanel(JComponent).paintDoubleBuffered(JComponent, Component,
> > Graphics, int, int, int, int) line: 4748
> > PageEditorPanel(JComponent)._paintImmediately(int, int, int, int) line:
> > 4692
> > PageEditorPanel(JComponent).paintImmediately(int, int, int, int) line:
> 4495
> > RepaintManager.paintDirtyRegions() line: 410
> > SystemEventQueueUtilities$ComponentWorkRequest.run() line: 117
> > InvocationEvent.dispatch() line: 178
> > EventQueue.dispatchEvent(AWTEvent) line: 454
> > EventDispatchThread.pumpOneEventForHierarchy(int, Component) line: 201
> > EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component)
> > line: 151
> > EventDispatchThread.pumpEvents(int, Conditional) line: 145
> > EventDispatchThread.pumpEvents(Conditional) line: 137
> > EventDispatchThread.run() line: 100
> >
> >
> > 3/ The Swing cursor is incorrect
> > In fact, it seems that the component positions are incorrectly computed,
> as
> > the cursor displayed is *not* the cursor assigned to the underlying
> > component. Moreover, it seems that it compute the position from absolute
> > screen (0,0). In other words, when your using a SplitPane, the vertical
> > divider cursor does not appear when the mouse is over the divider, but
> when
> > the mouse is left to the divider. And it seems that the distance between
> > this position and the divider correspond to the left corner of the
> embedded
> > frame, relative to absolute (0,0)
> >
> >
> > 4/ The editor is flashing
> > It seems that the Frame (or some other SWT component?) is painting its
> > background before the Swing component paints. As a result, it flashes
> with
> a
> > gray background.
> > I don't know how to overcome this.
> >
> >
> > Does anybody have an idea about these issues?
> >
> > Thanks,
> >
> > Phil.
> >
> >
|
|
|
Goto Forum:
Current Time: Sat Apr 20 03:05:44 GMT 2024
Powered by FUDForum. Page generated in 0.03091 seconds
|