本文整理汇总了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);
}
示例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;
}
示例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();
}
示例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;
}