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 257162 Details for
Bug 434393
[Cocoa] OS X: NPE in Control.internal_new_GC
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.
Sample to reproduce
ModifiedSnippet230.java (text/plain), 2.13 KB, created by
Thomas Singer
on 2015-10-08 10:47:23 EDT
(
hide
)
Description:
Sample to reproduce
Filename:
MIME Type:
Creator:
Thomas Singer
Created:
2015-10-08 10:47:23 EDT
Size:
2.13 KB
patch
obsolete
>import org.eclipse.swt.*; >import org.eclipse.swt.graphics.*; >import org.eclipse.swt.layout.*; >import org.eclipse.swt.widgets.*; > >/** > * @author Thomas Singer > */ >public class ModifiedSnippet230 { > public static void main(String [] args) { > Display display = new Display(); > final Image image = display.getSystemImage(SWT.ICON_INFORMATION); > Shell shell = new Shell(display); > shell.setText("Images on the right side of the TableItem"); > shell.setLayout(new FillLayout ()); > Table table = new Table(shell, SWT.MULTI | SWT.FULL_SELECTION); > table.setHeaderVisible(true); > table.setLinesVisible(true); > int columnCount = 3; > for (int i=0; i<columnCount; i++) { > TableColumn column = new TableColumn(table, SWT.NONE); > column.setText("Column " + i); > } > int itemCount = 8; > for(int i = 0; i < itemCount; i++) { > TableItem item = new TableItem(table, SWT.NONE); > item.setText(new String[] {"item "+i+" a", "item "+i+" b", "item "+i+" c"}); > } > /* > * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly. > * Therefore, it is critical for performance that these methods be > * as efficient as possible. > */ > Listener paintListener = new Listener() { > @Override > public void handleEvent(Event event) { > switch(event.type) { > case SWT.MeasureItem: { > Rectangle rect = image.getBounds(); > event.width += rect.width; > event.height = Math.max(event.height, rect.height + 2); > break; > } > case SWT.PaintItem: { > int x = event.x + event.width; > Rectangle rect = image.getBounds(); > int offset = Math.max(0, (event.height - rect.height) / 2); > event.gc.drawImage(image, x, event.y + offset); > break; > } > } > } > }; > table.addListener(SWT.MeasureItem, paintListener); > table.addListener(SWT.PaintItem, paintListener); > > for(int i = 0; i < columnCount; i++) { > final TableColumn column = table.getColumn(i); > column.pack(); > final int width = column.getWidth(); > column.setWidth(width - 10); > } > shell.setSize(500, 200); > shell.open(); > while(!shell.isDisposed ()) { > if(!display.readAndDispatch()) display.sleep(); > } > if(image != null) image.dispose(); > 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 434393
: 257162 |
258355