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 2414 Details for
Bug 23980
platform specific shell resize behaviour
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
snippet with "resizable" ON_TOP shell
ShellON_TOP.java (text/plain), 2.17 KB, created by
Grant Gayed
on 2002-11-13 16:58:30 EST
(
hide
)
Description:
snippet with "resizable" ON_TOP shell
Filename:
MIME Type:
Creator:
Grant Gayed
Created:
2002-11-13 16:58:30 EST
Size:
2.17 KB
patch
obsolete
>import org.eclipse.swt.SWT; >import org.eclipse.swt.custom.*; >import org.eclipse.swt.graphics.*; >import org.eclipse.swt.widgets.*; > >public class ShellON_TOP { > > static boolean activated = false; > static Shell resizableShell; > static final int DRAG_TOLERANCE = 4; > > public static void main(String[] args) { > final Display display = new Display(); > final Shell shell = new Shell(); > shell.setBounds(10, 10, 200, 200); > > final StyledText text = new StyledText(shell,SWT.BORDER); > text.setBounds(10,10,140,140); > text.addListener(SWT.KeyDown, new Listener() { > public void handleEvent(Event event) { > if (!activated) { > activated = true; > resizableShell = new Shell(shell, SWT.ON_TOP); > resizableShell.addListener(SWT.MouseMove, new Listener() { > public void handleEvent(Event event) { > if ((event.stateMask & SWT.BUTTON1) != 0) { > Display display = resizableShell.getDisplay(); > Rectangle bounds = resizableShell.getBounds(); > int edgeStyle = SWT.NONE; > if (bounds.width - event.x < DRAG_TOLERANCE) edgeStyle |= SWT.RIGHT; > if (bounds.height - event.y < DRAG_TOLERANCE) edgeStyle |= SWT.DOWN; > if (event.x < DRAG_TOLERANCE) edgeStyle |= SWT.LEFT; > if (event.y < DRAG_TOLERANCE) edgeStyle |= SWT.UP; > if (edgeStyle != SWT.NONE) { > Tracker tracker = new Tracker(display,edgeStyle | SWT.RESIZE); > tracker.setRectangles(new Rectangle[] {bounds}); > if (!tracker.open()) return; // cancelled > resizableShell.setBounds(tracker.getRectangles()[0]); > } > } > } > }); > > resizableShell.setBounds(60,60,100,100); > Table table = new Table(resizableShell, SWT.BORDER); > for (int i = 0; i < 3; i++) { > new TableItem(table,SWT.NONE).setText("aaa"); > } > table.setBounds(10,10,50,50); > resizableShell.setVisible(true); > resizableShell.addListener(SWT.Close, new Listener() { > public void handleEvent(Event event) { > activated = false; > } > }); > } > } > }); > > shell.open(); > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) { > display.sleep(); > } > } > } >}
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 23980
: 2414 |
87031