Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 210126 Details for
Bug 369821
On Linux, cannot change cursor while mouse is held down
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Test case
Shell_ChangeCursor.java (text/x-java), 1.86 KB, created by
Nam Quang Tran
on 2012-01-26 11:14:26 EST
(
hide
)
Description:
Test case
Filename:
MIME Type:
Creator:
Nam Quang Tran
Created:
2012-01-26 11:14:26 EST
Size:
1.86 KB
patch
obsolete
>package test; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.MouseAdapter; >import org.eclipse.swt.events.MouseEvent; >import org.eclipse.swt.events.MouseMoveListener; >import org.eclipse.swt.graphics.Point; >import org.eclipse.swt.graphics.Rectangle; >import org.eclipse.swt.layout.GridData; >import org.eclipse.swt.layout.GridLayout; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Label; >import org.eclipse.swt.widgets.Shell; > >public final class Shell_ChangeCursor { > > private static boolean dragged = false; > > public static void main(String[] args) { > final Display display = new Display(); > final Shell shell = new Shell(display); > shell.setLayout(new GridLayout()); > > final Label label = new Label(shell, SWT.BORDER); > label.addMouseListener(new MouseAdapter() { > @Override > public void mouseDown(MouseEvent e) { > dragged = true; > } > }); > label.addMouseListener(new MouseAdapter() { > @Override > public void mouseUp(MouseEvent e) { > shell.setCursor(null); > dragged = false; > } > }); > label.addMouseMoveListener(new MouseMoveListener() { > @Override > public void mouseMove(MouseEvent e) { > if (!dragged) > return; > Point size = label.getSize(); > Rectangle bounds = new Rectangle(0, 0, size.x, size.y); > if (bounds.contains(e.x, e.y)) { > System.out.println("NO"); > shell.setCursor(display.getSystemCursor(SWT.CURSOR_NO)); > } > else { > System.out.println("HAND"); > shell.setCursor(display.getSystemCursor(SWT.CURSOR_HAND)); > } > } > }); > GridData layoutData = new GridData(SWT.CENTER, SWT.CENTER, true, true); > layoutData.widthHint = 100; > label.setLayoutData(layoutData); > label.setBackground(display.getSystemColor(SWT.COLOR_YELLOW)); > > shell.setSize(400, 300); > shell.open(); > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) > display.sleep(); > } > display.dispose(); > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 369821
: 210126