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 55969 Details for
Bug 168715
MouseEvent button on MouseDraggedEvent
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.
Snippet which showing the value of me.button is always 0
MouseDraggedTest.java (text/x-java), 2.13 KB, created by
Manuel Selva
on 2006-12-20 11:16:11 EST
(
hide
)
Description:
Snippet which showing the value of me.button is always 0
Filename:
MIME Type:
Creator:
Manuel Selva
Created:
2006-12-20 11:16:11 EST
Size:
2.13 KB
patch
obsolete
>import org.eclipse.draw2d.Label; >import org.eclipse.draw2d.LightweightSystem; >import org.eclipse.draw2d.MouseEvent; >import org.eclipse.draw2d.MouseListener; >import org.eclipse.draw2d.MouseMotionListener; >import org.eclipse.draw2d.Panel; >import org.eclipse.draw2d.XYLayout; >import org.eclipse.draw2d.geometry.Rectangle; >import org.eclipse.swt.graphics.Color; >import org.eclipse.swt.graphics.Point; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; > >public class MouseDraggedTest { > > public static void main(String args[]){ > > //get the display > Display display = Display.getDefault(); > > //Shell creation > Shell shell = new Shell(); > shell.setText("Draw2d snippet"); > shell.setSize(new Point(300,200)); > shell.open(); > > //Draw2D components creation > LightweightSystem lws = new LightweightSystem(shell); > Panel panel = new Panel(); > panel.setLayoutManager(new XYLayout()); > Label clickLabel = new Label(); > clickLabel.setOpaque(true); > clickLabel.setBackgroundColor(new Color(display, 25, 125, 123)); > clickLabel.setForegroundColor(new Color(display, 255, 255, 255)); > clickLabel.setText("Click here"); > final Label result = new Label(); > > //Addition of draw2d listeners to the clickLabel > clickLabel.addMouseListener(new MouseListener(){ > public void mouseDoubleClicked(MouseEvent me) { > } > public void mousePressed(MouseEvent me) { > result.setText("Button " + me.button + " pressed!!"); > } > public void mouseReleased(MouseEvent me) { > result.setText("Button " + me.button + " released!!"); > } > }); > clickLabel.addMouseMotionListener(new MouseMotionListener(){ > public void mouseDragged(MouseEvent me) { > result.setText("Mouse dragged on button " + me.button); > } > public void mouseEntered(MouseEvent me) { > } > public void mouseExited(MouseEvent me) { > } > public void mouseHover(MouseEvent me) { > } > public void mouseMoved(MouseEvent me) { > } > }); > panel.add(clickLabel, new Rectangle(0,0,300,100)); > panel.add(result, new Rectangle(0,100,300,100)); > lws.setContents(panel); > > while (!shell.isDisposed ()) { > if (!display.readAndDispatch ()) > display.sleep (); > } > } >}
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 168715
: 55969 |
55970