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 154549 Details for
Bug 297942
[Printing] Client area is not centered according to printer trim
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 that prints a rectangle around client area
Snippet1.java (text/x-java), 1.06 KB, created by
Peter Severin
on 2009-12-16 04:54:38 EST
(
hide
)
Description:
Snippet that prints a rectangle around client area
Filename:
MIME Type:
Creator:
Peter Severin
Created:
2009-12-16 04:54:38 EST
Size:
1.06 KB
patch
obsolete
>package org.eclipse.swt.snippets; > >import org.eclipse.swt.graphics.GC; >import org.eclipse.swt.graphics.Rectangle; >import org.eclipse.swt.printing.PrintDialog; >import org.eclipse.swt.printing.Printer; >import org.eclipse.swt.printing.PrinterData; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; > >public class Snippet1 { > > public static void main(String[] args) { > Display display = new Display(); > Shell shell = new Shell(display); > > PrintDialog dlg = new PrintDialog(shell); > PrinterData data = dlg.open(); > if (data != null) { > printTestPage(data); > } > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) > display.sleep(); > } > display.dispose(); > } > > private static void printTestPage(PrinterData data) { > Printer printer = new Printer(data); > printer.startJob("test"); > GC gc = new GC(printer); > printer.startPage(); > Rectangle clientArea = printer.getClientArea(); > gc.drawRectangle(0, 0, clientArea.width - 1, clientArea.height - 1); > printer.endPage(); > gc.dispose(); > printer.endJob(); > printer.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 297942
: 154549