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 271188 Details for
Bug 393292
Toolbar buttons cut off in ubuntu 12.10
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.
demo swt app
Main.java (text/x-java), 4.03 KB, created by
Pavel Matveev
on 2017-10-26 07:27:38 EDT
(
hide
)
Description:
demo swt app
Filename:
MIME Type:
Creator:
Pavel Matveev
Created:
2017-10-26 07:27:38 EDT
Size:
4.03 KB
patch
obsolete
>package org.eclipse.swt.widgets; > >import java.util.ArrayList; >import java.util.Collection; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.SelectionAdapter; >import org.eclipse.swt.events.SelectionEvent; >import org.eclipse.swt.graphics.GC; >import org.eclipse.swt.graphics.Image; >import org.eclipse.swt.graphics.Point; >import org.eclipse.swt.layout.GridData; >import org.eclipse.swt.layout.GridLayout; > >public class Main { > > public static void main(String[] args) { > Display d = new Display(); > Shell sh = new Shell(d); > sh.setLayout(new GridLayout()); > Image im = new Image(null, 16, 16); > GC gc = new GC(im); > gc.setBackground(d.getSystemColor(SWT.COLOR_CYAN)); > gc.fillRectangle(0, 0, 16, 16); > > Composite c = new Composite(sh, SWT.NONE); > c.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); > c.setLayout(new GridLayout()); > Collection<ToolBar> tbs = new ArrayList<>(); > for (int i = 0; i < 10; i++) { > ToolBar tb = new ToolBar(c, SWT.FLAT | SWT.NO_FOCUS); > GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); > tb.setLayoutData(gd); > tbs.add(tb); > for (int j = 0; j < 5; j++) { > ToolItem ti = new ToolItem(tb, SWT.NONE); > ti.setImage(im); > } > } > Button b = new Button(c, SWT.NONE); > b.setText("Open Shell"); > b.addSelectionListener(new SelectionAdapter() { > > @Override > public void widgetSelected(SelectionEvent e) { > Shell sh2 = new Shell(sh, SWT.APPLICATION_MODAL | SWT.CLOSE); > sh2.setLayout(new GridLayout()); > Composite c2 = new Composite(sh2, SWT.NONE); > c2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); > c2.setLayout(new GridLayout()); > for (int i = 0; i < 10; i++) { > ToolBar tb = new ToolBar(c2, SWT.FLAT | SWT.NO_FOCUS); > GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); > tb.setLayoutData(gd); > tbs.add(tb); > for (int j = 0; j < 5; j++) { > ToolItem ti = new ToolItem(tb, SWT.NONE); > ti.setImage(im); > } > } > Button b = new Button(c2, SWT.CHECK); > b.setText("Create GC"); > b.setSelection(false); > b.addSelectionListener(new SelectionAdapter() { > > GC gc; > > @Override > public void widgetSelected(SelectionEvent e) { > if (b.getSelection()) { > if (gc != null) { > gc.dispose(); > } > gc = new GC(c); > } else { > if (gc != null) { > gc.dispose(); > gc = null; > } > } > } > > }); > Point parentLocation = sh.getLocation(); > sh2.setLocation(parentLocation.x + sh.getSize().x, parentLocation.y); > sh2.pack(); > sh2.open(); > } > > }); > sh.pack(); > sh.open(); > startRedrawToolBars(d, tbs); > while (!sh.isDisposed()) { > d.readAndDispatch(); > } > } > > private static void startRedrawToolBars(Display aDisply, Collection<ToolBar> aToolBars) { > aDisply.timerExec(100, new Runnable() { > > @Override > public void run() { > for (ToolBar tb : aToolBars) { > if (!tb.isDisposed()) { > tb.redraw(); > } > } > aDisply.timerExec(100, this); > } > > }); > } > >}
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 393292
:
223055
|
223199
|
223200
|
245142
|
247910
|
248410
| 271188 |
271189