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 95174 Details for
Bug 226103
findMouseEventTargetAt problem with local coordinate system
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.
Main reproducing the bug
BugWithLocalCoordinateSystem.java (text/x-java), 3.20 KB, created by
Manuel Selva
on 2008-04-08 05:38:28 EDT
(
hide
)
Description:
Main reproducing the bug
Filename:
MIME Type:
Creator:
Manuel Selva
Created:
2008-04-08 05:38:28 EDT
Size:
3.20 KB
patch
obsolete
> >import org.eclipse.draw2d.ColorConstants; >import org.eclipse.draw2d.FigureCanvas; >import org.eclipse.draw2d.IFigure; >import org.eclipse.draw2d.Label; >import org.eclipse.draw2d.LineBorder; >import org.eclipse.draw2d.MouseEvent; >import org.eclipse.draw2d.MouseListener; >import org.eclipse.draw2d.Panel; >import org.eclipse.draw2d.RectangleFigure; >import org.eclipse.draw2d.XYLayout; >import org.eclipse.draw2d.geometry.Rectangle; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; > >/** > * Sample class showing a bug when using local coordinate system. > * Launch the main and click on the blue label => The yellow rectangle is > * notified with a MousePressed event. > * > * @author Manuel Selva > * > */ >public class BugWithLocalCoordinateSystem { > > /** > * RectangleFigure using local coordinate system. > * > * @author Manuel Selva > */ > private class LocalCoordinateRectangle extends RectangleFigure { > > /* (non-Javadoc) > * @see org.eclipse.draw2d.Figure#useLocalCoordinates() > */ > @Override > protected boolean useLocalCoordinates() { > return true; > } > > } > > /** > * Opens a shell showing the bug. > */ > public BugWithLocalCoordinateSystem() { > > // Creates display and shell > Display display = new Display(); > Shell shell = new Shell(display); > shell.setLayout(new FillLayout()); > > // Creates the canvas > FigureCanvas canvas = new FigureCanvas(shell); > Panel panel = new Panel(); > panel.setLayoutManager(new XYLayout()); > > // Creates the canvas content > RectangleFigure rect = new LocalCoordinateRectangle(); > rect.setBackgroundColor(ColorConstants.red); > rect.setLayoutManager(new XYLayout()); > panel.add(rect, new Rectangle(5, 5, 250, 100)); > > RectangleFigure child = new RectangleFigure(); > child.setBackgroundColor(ColorConstants.yellow); > rect.add(child, new Rectangle(10, 10, 100, 30)); > child.setLineWidth(0); > child.addMouseListener(new MouseListener(){ > > public void mouseDoubleClicked(MouseEvent me) { > // > } > > public void mousePressed(MouseEvent me) { > IFigure source = (IFigure)me.getSource(); > if (source.getBorder() == null) { > source.setBorder(new LineBorder(5)); > } else { > source.setBorder(null); > } > } > > public void mouseReleased(MouseEvent me) { > // > } > }); > > RectangleFigure rect2 = new LocalCoordinateRectangle(); > rect2.setBackgroundColor(ColorConstants.orange); > rect2.setLayoutManager(new XYLayout()); > panel.add(rect2, new Rectangle(5, 110, 250, 100)); > > Label label = new Label("Click Here"); > label.setBackgroundColor(ColorConstants.blue); > label.setOpaque(true); > label.setForegroundColor(ColorConstants.white); > rect2.add(label, new Rectangle(10, 10, 100, 30)); > > canvas.setContents(panel); > > // Opens the shell and start UI loop > shell.pack(); > shell.setText("Local Coordinates"); > shell.open(); > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) { > display.sleep(); > } > } > display.dispose(); > } > > /** > * Main method. > * > * @param args > */ > public static void main(String[] args) { > > new BugWithLocalCoordinateSystem(); > } >}
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 226103
: 95174