org.eclipse.swt.widgets.Shell.getClientArea()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.eclipse.swt.widgets.Shell.getClientArea()方法的一些代码示例,展示了Shell.getClientArea()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.getClientArea()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:getClientArea

Shell.getClientArea介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

@Override
  public void controlResized(ControlEvent e){
    Rectangle shellSize = shell.getClientArea();
    list.setSize(shellSize.width, shellSize.height);
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

@Override
  public void controlResized(ControlEvent e){
    Rectangle shellSize = shell.getClientArea();
    list.setSize(shellSize.width, shellSize.height);
  }
});

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

public void controlResized(ControlEvent e){
    Rectangle shellSize = shell.getClientArea();
    list.setSize(shellSize.width, shellSize.height);
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

@Override
  public void controlResized(ControlEvent e){
    Rectangle shellSize = shell.getClientArea();
    list.setSize(shellSize.width, shellSize.height);
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

@Override
  public void controlResized(ControlEvent e){
    Rectangle shellSize = shell.getClientArea();
    list.setSize(shellSize.width, shellSize.height);
  }
});

代码示例来源:origin: org.eclipse/org.eclipse.help.ui

public void controlMoved(ControlEvent e) {
    if (HelpUIPlugin.DEBUG_INFOPOP) {
      System.out
          .println("ContextHelpDialog: shell control adapter called."); //$NON-NLS-1$
    }
    Rectangle clientArea = shell.getClientArea();
    shell.redraw(clientArea.x, clientArea.y, clientArea.width,
        clientArea.height, true);
    shell.update();
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

public Shell open (Display display) {
  Shell shell = new Shell (display);
  Label label = new Label (shell, SWT.CENTER);
  label.setText (resHello.getString("Hello_world"));
  label.setBounds (shell.getClientArea ());
  shell.open ();
  return shell;
}
}

代码示例来源:origin: BiglySoftware/BiglyBT

public BrowserWindow(Shell parent, String url, double wPct, double hPct,
    boolean allowResize, boolean isModal) {
  if (parent == null) {
    init(parent, url, 0, 0, allowResize, isModal);
  } else {
    Rectangle clientArea = parent.getClientArea();
    init(parent, url, (int) (clientArea.width * wPct),
        (int) (clientArea.height * hPct), allowResize, isModal);
  }
}

代码示例来源:origin: BiglySoftware/BiglyBT

public SimpleBrowserWindow(Shell parent, String url, double wPct, double hPct,
    boolean allowResize, boolean isModal) {
  if (parent == null) {
    init(parent, url, 0, 0, allowResize, isModal);
  } else {
    Rectangle clientArea = parent.getClientArea();
    init(parent, url, (int) (clientArea.width * wPct),
        (int) (clientArea.height * hPct), allowResize, isModal);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt

@Override
protected void layout(Composite composite, boolean flushCache) {
  if (root == null)
    return;
  Rectangle bounds = composite.getBounds();
  if (composite instanceof Shell)
    bounds = ((Shell) composite).getClientArea();
  else {
    bounds.x = 0;
    bounds.y = 0;
  }
  bounds.width -= (marginLeft + marginRight);
  bounds.height -= (marginTop + marginBottom);
  bounds.x += marginLeft;
  bounds.y += marginTop;
  sashes.clear();
  tileSubNodes(bounds, root);
}

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

@Override
protected void layout(Composite composite, boolean flushCache) {
  if (root == null)
    return;
  Rectangle bounds = composite.getBounds();
  if (composite instanceof Shell)
    bounds = ((Shell) composite).getClientArea();
  else {
    bounds.x = 0;
    bounds.y = 0;
  }
  bounds.width -= (marginLeft + marginRight);
  bounds.height -= (marginTop + marginBottom);
  bounds.x += marginLeft;
  bounds.y += marginTop;
  sashes.clear();
  tileSubNodes(bounds, root);
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
  public void paintControl(PaintEvent e) {
    e.gc.setForeground(Colors.getSystemColor(e.display, SWT.COLOR_WIDGET_BORDER));
    Rectangle clientArea = shell.getClientArea();
    e.gc.drawRectangle(0, 0, clientArea.width - 1, clientArea.height - 1);
  }
});

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

public void handleEvent(Event event) {
    if (event.detail != SWT.DRAG) {
      Rectangle clientArea = shell.getClientArea();
      int newWidth = clientArea.width - event.x - (sash.getSize().x + rightSeparator.getSize().x);
      if (newWidth != data.widthHint) {
        data.widthHint = newWidth;
        shell.layout();
      }
    }
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

public Shell open (Display display) {
  final Shell shell = new Shell (display);
  final Label label = new Label (shell, SWT.CENTER);
  label.setText (resHello.getString("Hello_world"));
  label.pack();
  shell.addControlListener(ControlListener.controlResizedAdapter(e ->    label.setBounds (shell.getClientArea ())));
  shell.pack();
  shell.open ();
  return shell;
}
}

代码示例来源:origin: BiglySoftware/BiglyBT

/**
 *
 *
 * @param layout
 * @since 4.1.0.5
 */
protected void resetProfileInfoBox(boolean layout) {
  if (soInfoTitle != null) {
    soInfoTitle.setTextID("devices.choose.profile.info.title");
  }
  if (soInfoText != null) {
    soInfoText.setTextID("devices.choose.profile.info.text");
    if (layout) {
      Point computeSize = shell.computeSize(shell.getClientArea().width,
          SWT.DEFAULT, true);
      shell.setSize(computeSize);
    }
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

void handleResize(ControlEvent event) {
  Rectangle rect = shell.getClientArea();
  Point cSize = coolBar.computeSize(rect.width, SWT.DEFAULT);
  Point sSize = statusBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
  int statusMargin = 2;
  coolBar.setBounds(rect.x, rect.y, cSize.x, cSize.y);
  styledText.setBounds(rect.x, rect.y + cSize.y, rect.width, rect.height - cSize.y - (sSize.y + 2 * statusMargin));
  statusBar.setBounds(rect.x + statusMargin, rect.y + rect.height - sSize.y - statusMargin, rect.width - (2 * statusMargin), sSize.y);
}

代码示例来源:origin: stefanhaustein/flowgrid

@Override
public void widgetSelected(SelectionEvent e) {
  Menu menu = new Menu(shell);
  currentEditor.fillMenu(menu);
  menu.setLocation(shell.toDisplay(shell.getSize().x, shell.getClientArea().y));
  menu.setVisible(true);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

public Shell open (Display display) {
  final Color red = new Color(display, 0xFF, 0, 0);
  final Shell shell = new Shell (display);
  shell.addPaintListener(event -> {
    GC gc = event.gc;
    gc.setForeground(red);
    Rectangle rect = shell.getClientArea();
    gc.drawRectangle(rect.x + 10, rect.y + 10, rect.width - 20, rect.height - 20);
    gc.drawString(resHello.getString("Hello_world"), rect.x + 20, rect.y + 20);
  });
  shell.addDisposeListener (e -> red.dispose());
  shell.open ();
  return shell;
}
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt

public Overlay(Shell shell) {
  baseShell = shell;
  Rectangle cr = baseShell.getClientArea();
  Rectangle trim = baseShell.computeTrim(cr.x, cr.y, cr.width, cr.height);
  offsetX = -trim.x;
  offsetY = -trim.y;
  overlayShell = new Shell(baseShell, SWT.NO_TRIM | SWT.ON_TOP);
  overlayShell.setBounds(baseShell.getBounds());
  overlayShell.setBackground(baseShell.getDisplay().getSystemColor(
      SWT.COLOR_DARK_GREEN));
  overlayShell.setAlpha(128);
  blue = new Color(baseShell.getDisplay(), 0, 0, 128);
  overlayShell.addPaintListener(e -> {
    e.gc.setForeground(blue);
    e.gc.setBackground(blue);
    for (Adornment adornment : adornments) {
      adornment.drawAdornment(e.gc);
    }
  });
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
public Rectangle getMetrics(int windowElement) {
  switch (windowElement) {
    case WINDOW_ELEMENT_TOOLBAR:
      break;
    case WINDOW_ELEMENT_TOPBAR:
      SWTSkinObject skinObject = skin.getSkinObject(SkinConstants.VIEWID_PLUGINBAR);
      if (skinObject != null) {
        return skinObject.getControl().getBounds();
      }
      break;
    case WINDOW_ELEMENT_STATUSBAR:
      return statusBar.getBounds();
    case WINDOW_CLIENT_AREA:
      return shell.getClientArea();
    case WINDOW_CONTENT_DISPLAY_AREA:
      Rectangle r = getMetrics(WINDOW_CLIENT_AREA);
      r.height -= getMetrics(WINDOW_ELEMENT_TOPBAR).height;
      r.height -= getMetrics(WINDOW_ELEMENT_TOOLBAR).height;
      r.height -= getMetrics(WINDOW_ELEMENT_STATUSBAR).height;
      return r;
  }
  return new Rectangle(0, 0, 0, 0);
}

相关文章

微信公众号

最新文章

更多

Shell类方法