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 50385 Details for
Bug 152555
Setting alpha transparency makes font style change unexpectedly.
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.
Piece of code that makes the bug appear
AlphablendingBug.java (text/plain), 2.57 KB, created by
cricri
on 2006-09-18 11:17:14 EDT
(
hide
)
Description:
Piece of code that makes the bug appear
Filename:
MIME Type:
Creator:
cricri
Created:
2006-09-18 11:17:14 EDT
Size:
2.57 KB
patch
obsolete
>package src; > > >import org.eclipse.draw2d.ColorConstants; >import org.eclipse.draw2d.Figure; >import org.eclipse.draw2d.Graphics; >import org.eclipse.draw2d.LightweightSystem; >import org.eclipse.draw2d.LineBorder; >import org.eclipse.draw2d.MouseEvent; >import org.eclipse.draw2d.ScalableFreeformLayeredPane; >import org.eclipse.draw2d.XYLayout; >import org.eclipse.draw2d.geometry.Rectangle; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; > >public class AlphablendingBug { > public static void main(String[] args) { > Display d = new Display(); > final Shell shell = new Shell(d); > LightweightSystem lws = new LightweightSystem(shell); > ScalableFreeformLayeredPane contents = new ScalableFreeformLayeredPane(); // Simulates what we have with a ScalableRootEditPart > > XYLayout contentsLayout = new XYLayout(); > > shell.setSize(400,400); > shell.setText("Hosting Shell"); > > contents.setLayoutManager(contentsLayout); > contents.setScale(1.5); // Works if set to 1.0 > > ToggleFigure foo1 = new ToggleFigure(); > contentsLayout.setConstraint(foo1, new Rectangle(10, 10, 100, 100)); > contents.add(foo1); > > ToggleFigure foo2 = new ToggleFigure(); > contentsLayout.setConstraint(foo2, new Rectangle(109, 10, 100, 100)); // Both figures must have a common border > contents.add(foo2); > > lws.setContents(contents); > shell.open(); > while(! shell.isDisposed()) { > while(! d.readAndDispatch()) > d.sleep(); > } > } >} > >class ToggleFigure extends Figure { > public ToggleFigure () { > setForegroundColor(ColorConstants.red); > setBackgroundColor(ColorConstants.lightGray); > setBorder(new LineBorder()); > setOpaque(false); > } > > @Override > protected boolean isMouseEventTarget() { > return true; > } > > @Override > public void handleMousePressed(MouseEvent event) { > setOpaque(! isOpaque()); > } > > @Override > public void paintFigure(Graphics graphics) { > graphics.setAlpha(100); > if(isOpaque()) > graphics.fillRectangle(bounds); > graphics.translate(bounds.x, bounds.y); > graphics.drawString("Text", 0, 0); > } > > /*** SWAPPING DRAWTEXT AND FILLRECTANGLE SOLVES THE PROBLEM: ***/ > > /* > @Override > public void paintFigure(Graphics graphics) { > graphics.translate(bounds.x, bounds.y); > graphics.drawString("Text", 0, 0); > graphics.translate(-bounds.x, -bounds.y); > graphics.setAlpha(100); > if(isOpaque()) > graphics.fillRectangle(bounds); > } > */ >}
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 152555
: 50385