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 6687 Details for
Bug 26095
DCR - possibility to print the content of SWT widgets
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.
Code to print the contents of a widget (WINDOWS ONLY)
PR_26095.java (text/plain), 2.72 KB, created by
Steve Northover
on 2003-11-06 17:09:33 EST
(
hide
)
Description:
Code to print the contents of a widget (WINDOWS ONLY)
Filename:
MIME Type:
Creator:
Steve Northover
Created:
2003-11-06 17:09:33 EST
Size:
2.72 KB
patch
obsolete
>package steve; > >import org.eclipse.swt.*; >import org.eclipse.swt.graphics.*; >import org.eclipse.swt.widgets.*; >import org.eclipse.swt.custom.*; > >import org.eclipse.swt.internal.win32.*; > >public class PR_26095 { > >public static void main (String [] args) { > >// #define PRF_CHECKVISIBLE 0x00000001L >// #define PRF_NONCLIENT 0x00000002L >// #define PRF_CLIENT 0x00000004L >// #define PRF_ERASEBKGND 0x00000008L >// #define PRF_CHILDREN 0x00000010L >// #define PRF_OWNED 0x00000020L >// #define WM_PRINT 0x0317 >// #define WM_PRINTCLIENT 0x0318 > > Display display = new Display (); > Shell shell = new Shell (display); > shell.open (); > >// Button b = new Button (shell, SWT.ARROW); >// b.setText ("Hello"); >// b.setSize (200, 200); >// Control control = b; > > StyledText text = new StyledText (shell, SWT.BORDER | SWT.V_SCROLL); > text.setText ("Hello\nThere\nChrix"); > text.setSize (200, 200); > Control control = text; > >// Table table = new Table(shell, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); >// table.setSize(200, 200); >// table.setLinesVisible(true); >// table.setHeaderVisible(true); >// String[] columnTitles = {" ", "C", "!", "Description", "Resource", "In Folder", "Location" }; >// for (int i = 0; i < columnTitles.length; i++) { >// TableColumn tableColumn = new TableColumn(table, SWT.NULL); >// tableColumn.setText(columnTitles[i]); >// } >// int count = 128; >// for (int i = 0; i < count; i++) { >// TableItem item = new TableItem(table, SWT.NULL); >// item.setText(0, "x"); >// item.setText(1, "y"); >// item.setText(2, "!"); >// item.setText(3, "None of this stuff behaves the way I want"); >// item.setText(4, "Almost_Everywhere"); >// item.setText(5, "Some.darn.folder man"); >// item.setText(6, "line " + i + " in Nowhere"); >// } >// for (int i = 0; i < columnTitles.length; i++) { >// table.getColumn(i).pack(); >// } >// table.setSize(table.computeSize(SWT.DEFAULT, 200)); >// Control control = table; > > Rectangle rect = control.getBounds (); > Image image = new Image (display, rect.width, rect.height); > int WM_PRINT = 0x0317; > int PRF_CHECKVISIBLE = 0x00000001; > int PRF_NONCLIENT = 0x00000002; > int PRF_CLIENT = 0x00000004; > int PRF_ERASEBKGND = 0x00000008; > int PRF_CHILDREN = 0x00000010; > int PRF_OWNED = 0x00000020; > int bits = PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND; > GC gc = new GC (image); > OS.SendMessage (control.handle, WM_PRINT, gc.handle, bits); > gc.dispose (); > gc = new GC (shell); > gc.drawImage (image, 0, 200+50); > gc.dispose (); > image.dispose (); > 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 26095
: 6687