Exemplo n.º 1
0
 private void setHoverLocation(
     org.eclipse.swt.widgets.Shell shell, org.eclipse.swt.graphics.Point position) {
   org.eclipse.swt.graphics.Rectangle displayBounds = shell.getDisplay().getBounds();
   org.eclipse.swt.graphics.Rectangle shellBounds = shell.getBounds();
   shellBounds.x = Math.max(Math.min(position.x, displayBounds.width - shellBounds.width), 0);
   shellBounds.y =
       Math.max(Math.min(position.y + 16, displayBounds.height - shellBounds.height), 0);
   shell.setBounds(shellBounds);
 }
Exemplo n.º 2
0
 public ToolTipHandler(org.eclipse.swt.widgets.Shell parent) {
   final org.eclipse.swt.widgets.Display display = parent.getDisplay();
   this.parentShell = parent;
   tipShell = new org.eclipse.swt.widgets.Shell(parent, SWT.ON_TOP | SWT.TOOL);
   org.eclipse.swt.layout.GridLayout gridLayout = new org.eclipse.swt.layout.GridLayout();
   gridLayout.numColumns = 2;
   gridLayout.marginWidth = 2;
   gridLayout.marginHeight = 2;
   tipShell.setLayout(gridLayout);
   tipShell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
   tipLabelImage = new org.eclipse.swt.widgets.Label(tipShell, SWT.NONE);
   tipLabelImage.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
   tipLabelImage.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
   tipLabelImage.setLayoutData(
       new org.eclipse.swt.layout.GridData(
           GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
   tipLabelText = new org.eclipse.swt.widgets.Label(tipShell, SWT.NONE);
   tipLabelText.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
   tipLabelText.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
   tipLabelText.setLayoutData(
       new org.eclipse.swt.layout.GridData(
           (-(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER))));
 }