本文整理匯總了Java中org.eclipse.swt.widgets.Shell.setBounds方法的典型用法代碼示例。如果您正苦於以下問題:Java Shell.setBounds方法的具體用法?Java Shell.setBounds怎麽用?Java Shell.setBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Shell
的用法示例。
在下文中一共展示了Shell.setBounds方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureShell
import org.eclipse.swt.widgets.Shell; //導入方法依賴的package包/類
@Override
public void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Limit chars logs");
newShell.setSize(nWidth, nHeight);
int nLeft = 0;
int nTop = 0;
Display display = newShell.getDisplay();
Point pt = display.getCursorLocation();
Monitor[] monitors = display.getMonitors();
for (int i = 0; i < monitors.length; i++) {
if (monitors[i].getBounds().contains(pt)) {
Rectangle rect = monitors[i].getClientArea();
if (rect.x < 0)
nLeft = ((rect.width - nWidth) / 2) + rect.x;
else
nLeft = (rect.width - nWidth) / 2;
if (rect.y < 0)
nTop = ((rect.height - nHeight) / 2) + rect.y;
else
nTop = (rect.height - nHeight) / 2;
break;
}
}
newShell.setBounds(nLeft, nTop, nWidth, nHeight);
}
示例2: configureShell
import org.eclipse.swt.widgets.Shell; //導入方法依賴的package包/類
@Override
public void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Parameters availables");
newShell.setSize(nWidth, nHeight);
int nLeft = 0;
int nTop = 0;
Display display = newShell.getDisplay();
Point pt = display.getCursorLocation();
Monitor[] monitors = display.getMonitors();
for (int i = 0; i < monitors.length; i++) {
if (monitors[i].getBounds().contains(pt)) {
Rectangle rect = monitors[i].getClientArea();
if (rect.x < 0)
nLeft = ((rect.width - nWidth) / 2) + rect.x;
else
nLeft = (rect.width - nWidth) / 2;
if (rect.y < 0)
nTop = ((rect.height - nHeight) / 2) + rect.y;
else
nTop = (rect.height - nHeight) / 2;
break;
}
}
newShell.setBounds(nLeft, nTop, nWidth, nHeight);
}
示例3: configureShell
import org.eclipse.swt.widgets.Shell; //導入方法依賴的package包/類
@Override
public void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(dialogTitle);
int nLeft = 0;
int nTop = 0;
Display display = newShell.getDisplay();
// // mods jmc 22/10/2013
// nWidth = newShell.getSize().x;
// nHeight = newShell.getSize().y;
Point pt = display.getCursorLocation();
Monitor [] monitors = display.getMonitors();
for (int i= 0; i<monitors.length; i++) {
if (monitors[i].getBounds().contains(pt)) {
Rectangle rect = monitors[i].getClientArea();
if (rect.x < 0)
nLeft = ((rect.width - nWidth) / 2) + rect.x;
else
nLeft = (rect.width - nWidth) / 2;
if (rect.y < 0)
nTop = ((rect.height - nHeight) / 2) + rect.y;
else
nTop = (rect.height - nHeight) / 2;
break;
}
}
newShell.setBounds(nLeft, nTop, nWidth, nHeight);
}
示例4: configureShell
import org.eclipse.swt.widgets.Shell; //導入方法依賴的package包/類
@Override
public void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Engine Log settings");
newShell.setSize(nWidth, nHeight);
int nLeft = 0;
int nTop = 0;
Display display = newShell.getDisplay();
Point pt = display.getCursorLocation();
Monitor[] monitors = display.getMonitors();
for (int i = 0; i < monitors.length; i++) {
if (monitors[i].getBounds().contains(pt)) {
Rectangle rect = monitors[i].getClientArea();
if (rect.x < 0)
nLeft = ((rect.width - nWidth) / 2) + rect.x;
else
nLeft = (rect.width - nWidth) / 2;
if (rect.y < 0)
nTop = ((rect.height - nHeight) / 2) + rect.y;
else
nTop = (rect.height - nHeight) / 2;
break;
}
}
newShell.setBounds(nLeft, nTop, nWidth, nHeight);
}
示例5: createCommentBoxShell
import org.eclipse.swt.widgets.Shell; //導入方法依賴的package包/類
private void createCommentBoxShell(org.eclipse.swt.graphics.Rectangle commentBoxEditorBounds) {
shell = new Shell(getParent(), SWT.NONE);
shell.setBounds(commentBoxEditorBounds);
GridLayout gl_shell = new GridLayout(1, false);
gl_shell.verticalSpacing = 0;
gl_shell.marginWidth = 0;
gl_shell.marginHeight = 0;
gl_shell.horizontalSpacing = 0;
shell.setLayout(gl_shell);
}
示例6: configureShell
import org.eclipse.swt.widgets.Shell; //導入方法依賴的package包/類
@Override
protected void configureShell(Shell shell) {
shell.setText("Schema Viewer Preferences");
shell.setImage(AvroSchemaEditorActivator.getImage(AvroSchemaEditorImages.CONFIGURE));
shell.setBounds(bounds);
super.configureShell(shell);
}
示例7: performPostDialogCreation
import org.eclipse.swt.widgets.Shell; //導入方法依賴的package包/類
@Override
public void performPostDialogCreation() {
// mods jmc 26/07/2013
int nWidth;
int nHeight;
int nLeft = 0;
int nTop = 0;
Shell newShell = this.parentDialog.getShell();
// mods jmc 22/10/2013
nWidth = (int) (0.50 * newShell.getSize().x);
nHeight = (int) (0.60 * newShell.getSize().y);
Display display = newShell.getDisplay();
Point pt = display.getCursorLocation();
Monitor [] monitors = display.getMonitors();
for (int i= 0; i<monitors.length; i++) {
if (monitors[i].getBounds().contains(pt)) {
Rectangle rect = monitors[i].getClientArea();
if (rect.x < 0)
nLeft = ((rect.width - nWidth) / 2) + rect.x;
else
nLeft = (rect.width - nWidth) / 2;
if (rect.y < 0)
nTop = ((rect.height - nHeight) / 2) + rect.y;
else
nTop = (rect.height - nHeight) / 2;
break;
}
}
newShell.setBounds(nLeft, nTop, nWidth, nHeight);
super.performPostDialogCreation();
}
示例8: openFilesMiniView
import org.eclipse.swt.widgets.Shell; //導入方法依賴的package包/類
private void openFilesMiniView(DownloadManager dm, TableCell cell) {
Shell shell = ShellFactory.createShell(Utils.findAnyShell(), SWT.SHELL_TRIM);
FillLayout fillLayout = new FillLayout();
fillLayout.marginHeight = 2;
fillLayout.marginWidth = 2;
shell.setLayout(fillLayout);
Rectangle bounds = ((TableCellSWT) cell).getBoundsOnDisplay();
bounds.y += bounds.height;
bounds.width = 630;
bounds.height = (16 * dm.getNumFileInfos()) + 60;
Rectangle realBounds = shell.computeTrim(0, 0, bounds.width, bounds.height);
realBounds.width -= realBounds.x;
realBounds.height -= realBounds.y;
realBounds.x = bounds.x;
realBounds.y = bounds.y;
if (bounds.height > 500) {
bounds.height = 500;
}
shell.setBounds(realBounds);
shell.setAlpha(230);
Utils.verifyShellRect(shell, true);
final FilesView view = new FilesView(false);
view.dataSourceChanged(dm);
view.initialize(shell);
Composite composite = view.getComposite();
//composite.setLayoutData(null);
//shell.setLayout(new FillLayout());
view.viewActivated();
view.refresh();
final UIUpdatable viewUpdater = new UIUpdatable() {
@Override
public void updateUI() {
view.refresh();
}
@Override
public String getUpdateUIName() {
return view.getFullTitle();
}
};
UIUpdaterSWT.getInstance().addUpdater(viewUpdater);
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
UIUpdaterSWT.getInstance().removeUpdater(viewUpdater);
view.delete();
}
});
shell.layout(true, true);
shell.setText(dm.getDisplayName());
shell.open();
}
示例9: copyToClipBoard
import org.eclipse.swt.widgets.Shell; //導入方法依賴的package包/類
void copyToClipBoard() {
Composite item = viewer;
Point p = viewer.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Rectangle size = item.getClientArea();
System.out.println(p + " " + size);
// compositeViewer.setBackground(Constants.HIGHLIGHT_COLOR);
GC gc = new GC(item);
// Rectangle clipping2 = gc.getClipping();
// Image img = new Image(Display.getDefault(), size.width, size.height);
// gc.copyArea(img, 0, 0);
// ImageData imageData = img.getImageData();
RGB[] rgb = new RGB[256];
// build grey scale palette: 256 different grey values are generated.
for (int i = 0; i < 256; i++) {
rgb[i] = new RGB(i, i, i);
}
// Construct a new indexed palette given an array of RGB values.
PaletteData palette = new PaletteData(rgb);
Image img2 = new Image(Display.getDefault(), new ImageData(size.width, size.height, 8, palette));
// gc.setClipping(0, 0, p.x, p.y);
gc.copyArea(img2, 0, 0);
Shell popup = new Shell(Display.getDefault());
popup.setText("Image");
popup.setBounds(50, 50, 200, 200);
Canvas canvas = new Canvas(popup, SWT.NONE);
canvas.setBounds(img2.getBounds());
canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.drawImage(img2, 0, 0);
}
});
popup.open();
Clipboard clipboard = new Clipboard(Display.getDefault());
clipboard.setContents(new Object[]{img2.getImageData()}, new Transfer[]{ ImageTransfer.getInstance()});
img2.dispose();
gc.dispose();
}