当前位置: 首页>>代码示例>>Java>>正文


Java Region.getBounds方法代码示例

本文整理汇总了Java中org.eclipse.swt.graphics.Region.getBounds方法的典型用法代码示例。如果您正苦于以下问题:Java Region.getBounds方法的具体用法?Java Region.getBounds怎么用?Java Region.getBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.graphics.Region的用法示例。


在下文中一共展示了Region.getBounds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setShell

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
public void setShell() {

		Region region = getBackRegionFromImage(display, backgroundImageName);

		/* Capture the transparent regions and remove them */
		Region corner = handleTransparenceRegion(backgroundImage, 0, 0);
		region.subtract(corner);
		shell.setRegion(region);

		/* Set shell size and background according to the region */
		Rectangle size = region.getBounds();
		shell.setSize(size.width, size.height);

		/* Load background */
		ImageLoader loader = new ImageLoader();
		ImageData[] imageData = loader.load(ResourceLoader
				.load(backgroundImageName));
		Image image = new Image(null, imageData[0]);
		shell.setBackgroundImage(image);
		shell.setBackgroundMode(SWT.INHERIT_FORCE);

		/* Set icon */
		Image shellIcon = new Image(Display.getCurrent(),
				GUI.class.getResourceAsStream("/GUI/JustDoIt/image/icon.png"));
		shell.setImage(shellIcon);

		/* Put the shell in center of screen */
		center(shell);
	}
 
开发者ID:chenzeyu,项目名称:JustDoIt-A-Task-Manager,代码行数:30,代码来源:GUI.java

示例2: getPopOverLocationControlOffscreen

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
private Point getPopOverLocationControlOffscreen(Rectangle displayBounds,
                                                 Region popOverRegion,
                                                 Point poppedOverItemLocationRelativeToDisplay,
                                                 Point popOverOffscreenLocation) {
  Point appropriateDisplayLocation = popOverOffscreenLocation;
  Rectangle popOverRegionBounds = popOverRegion.getBounds();
  if (!displayBounds.contains(new Point(poppedOverItemLocationRelativeToDisplay.x + popOverRegionBounds.width, 0))) {
    appropriateDisplayLocation.x = displayBounds.width - popOverRegionBounds.width;
  }
  if (!displayBounds.contains(new Point(0, poppedOverItemLocationRelativeToDisplay.y + popOverRegionBounds.height))) {
    appropriateDisplayLocation.y = displayBounds.height - popOverRegionBounds.height;
  }

  return appropriateDisplayLocation;
}
 
开发者ID:ReadyTalk,项目名称:swt-bling,代码行数:16,代码来源:PopOverShell.java

示例3: redrawGadget

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
public void redrawGadget() {
	// create the region defining the gadget
	Region region = new Region();

	// set the circle data to the region
	int polygon = profiler.getPolygon();

	region.add(GadgetProfiler.generateCircle(polygon, polygon, polygon));

	// define the shape of the shell
	gadget.getShell().setRegion(region);

	Rectangle size = region.getBounds();
	gadget.getShell().setSize(size.width, size.height);

	// dispose of the region object
	region.dispose();

}
 
开发者ID:coddo,项目名称:TeamSubb,代码行数:20,代码来源:GadgetController.java

示例4: getPopOverShellLocation

import org.eclipse.swt.graphics.Region; //导入方法依赖的package包/类
private Point getPopOverShellLocation(Shell parentShell, PoppedOverItem poppedOverItem, Region popOverRegion) {

    Point location;
    Rectangle displayBounds = null;

    try {
      Display display = displaySafe.getLatestDisplay();
      displayBounds = display.getBounds();
    } catch (DisplaySafe.NullDisplayException nde) {
      LOG.warning("Could not find display");
    }

    Rectangle popOverBounds = popOverRegion.getBounds();
    Point poppedOverItemLocationRelativeToDisplay =
            getPoppedOverItemRelativeLocation(poppedOverItem);

    // Guess on the location first
    location = getPopOverDisplayPoint(popOverBounds, poppedOverItem, poppedOverItemLocationRelativeToDisplay,
            popOverEdgeCenteredOnParent, popOverAboveOrBelowParent);

    // Adjust as needed
    if (popOverAboveOrBelowParent == VerticalLocation.BELOW) {
      if (isBottomCutOff(displayBounds, location, popOverBounds)) {
        popOverAboveOrBelowParent = VerticalLocation.ABOVE;
        location.y = getPopOverYLocation(popOverBounds, poppedOverItem, poppedOverItemLocationRelativeToDisplay,
                popOverAboveOrBelowParent);
      }
    } else {
      if (isTopCutOff(location)) {
        popOverAboveOrBelowParent = VerticalLocation.BELOW;
        location.y = getPopOverYLocation(popOverBounds, poppedOverItem, poppedOverItemLocationRelativeToDisplay,
            popOverAboveOrBelowParent);
      }
    }

    if (popOverEdgeCenteredOnParent == CenteringEdge.LEFT) {
      if (isRightCutOff(displayBounds, location, popOverBounds)) {
        popOverEdgeCenteredOnParent = CenteringEdge.RIGHT;
        location.x = getPopOverXLocation(popOverBounds, poppedOverItem, poppedOverItemLocationRelativeToDisplay,
                popOverEdgeCenteredOnParent);
      }
    } else {
      if (isLeftCutOff(location)) {
        popOverEdgeCenteredOnParent = CenteringEdge.LEFT;
        location.x = getPopOverXLocation(popOverBounds, poppedOverItem, poppedOverItemLocationRelativeToDisplay,
            popOverEdgeCenteredOnParent);
      }
    }

    if (isStillOffScreen(displayBounds, location, popOverBounds)) {
      location = getPopOverLocationControlOffscreen(displayBounds, popOverRegion,
              poppedOverItemLocationRelativeToDisplay, location);
    }

    return location;
  }
 
开发者ID:ReadyTalk,项目名称:swt-bling,代码行数:57,代码来源:PopOverShell.java


注:本文中的org.eclipse.swt.graphics.Region.getBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。