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


Java Rectangle.getCenterY方法代码示例

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


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

示例1: testSplash

import java.awt.Rectangle; //导入方法依赖的package包/类
static void testSplash(ImageInfo test) throws Exception {
    SplashScreen splashScreen = SplashScreen.getSplashScreen();
    if (splashScreen == null) {
        throw new RuntimeException("Splash screen is not shown!");
    }
    Graphics2D g = splashScreen.createGraphics();
    Rectangle splashBounds = splashScreen.getBounds();
    int screenX = (int) splashBounds.getCenterX();
    int screenY = (int) splashBounds.getCenterY();
    Robot robot = new Robot();
    Color splashScreenColor = robot.getPixelColor(screenX, screenY);

    float scaleFactor = getScaleFactor();
    Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;
    if (!compare(testColor, splashScreenColor)) {
        throw new RuntimeException(
                "Image with wrong resolution is used for splash screen!");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:UnixMultiResolutionSplashTest.java

示例2: testSplash

import java.awt.Rectangle; //导入方法依赖的package包/类
static void testSplash(ImageInfo test) throws Exception {
    SplashScreen splashScreen = SplashScreen.getSplashScreen();

    if (splashScreen == null) {
        throw new RuntimeException("Splash screen is not shown!");
    }

    Graphics2D g = splashScreen.createGraphics();
    Rectangle splashBounds = splashScreen.getBounds();
    int screenX = (int) splashBounds.getCenterX();
    int screenY = (int) splashBounds.getCenterY();
    if (splashBounds.width != IMAGE_WIDTH) {
        throw new RuntimeException(
                "SplashScreen#getBounds has wrong width");
    }
    if (splashBounds.height != IMAGE_HEIGHT) {
        throw new RuntimeException(
                "SplashScreen#getBounds has wrong height");
    }

    Robot robot = new Robot();
    Color splashScreenColor = robot.getPixelColor(screenX, screenY);
    float scaleFactor = getScaleFactor();
    Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;

    if (!compare(testColor, splashScreenColor)) {
        throw new RuntimeException(
                "Image with wrong resolution is used for splash screen!");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:MultiResolutionSplashTest.java

示例3: tick

import java.awt.Rectangle; //导入方法依赖的package包/类
@Override public void tick(double progress) {
    double nextZoom = progress >= 1.0 ? targetZoom :
        (sourceZoom + progress * (targetZoom - sourceZoom));

    Scene scene = getScene();
    JComponent view = scene.getView ();

    if (view != null) {
        Point viewLocation = view.getVisibleRect ().getLocation();
        Dimension viewSize = view.getVisibleRect ().getSize();
        Point oldCenter = scene.convertSceneToView (center);

        ((DependencyGraphScene)scene).setMyZoomFactor (nextZoom);
        scene.validate (); // HINT - forcing to change preferred size of the JComponent view

        Point newCenter = scene.convertSceneToView (center);
        Rectangle viewBounds = view.getVisibleRect();
        Point visibleCenter = new Point((int)viewBounds.getCenterX(), (int)viewBounds.getCenterY());
        newCenter.x += Math.round((newCenter.x - visibleCenter.x) * progress);
        newCenter.y += Math.round((newCenter.y - visibleCenter.y) * progress);

        view.scrollRectToVisible (new Rectangle (
                newCenter.x - oldCenter.x + viewLocation.x,
                newCenter.y - oldCenter.y + viewLocation.y,
                viewSize.width,
                viewSize.height
        ));
    } else {
        ((DependencyGraphScene)scene).setMyZoomFactor (nextZoom);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:CenteredZoomAnimator.java

示例4: init

import java.awt.Rectangle; //导入方法依赖的package包/类
private void init() {
    int nds = scene.getNodes().size();
    bounds = new Rectangle(magicSizeConstant  + (magicSizeMultiplier * nds), 
                           magicSizeConstant  + (magicSizeMultiplier * nds)); //g.getMaximumBounds();
    temp = bounds.getWidth() / 10;
    forceConstant = 0.75 * Math.sqrt(bounds.getHeight() * bounds.getWidth() / nds);
    
    GraphNode<I> rn = scene.getRootGraphNode();
    NodeWidget rw = getWidget(rn);
    rw.locX = bounds.getCenterX();
    rw.locY = bounds.getCenterY();
    rw.setFixed(true);
    layoutCirculary(scene.getNodes(), rn);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:FruchtermanReingoldLayout.java

示例5: drawOverEntities

import java.awt.Rectangle; //导入方法依赖的package包/类
@Override
public void drawOverEntities(Graphics2D g, int s)
{
	float time = Math.max(T(), getLength());
	Shape bound = pos.getBorder(s);
	Rectangle border = bound.getBounds();
	Point2D.Double f = new Point2D.Double(border.getCenterX(), border.getCenterY());
	Paint grad = new RadialGradientPaint(f, s / 3, new float[] {0, .7f, 1}, new Color[]{
			new Color(1, 0, 0, 0), 
			new Color(1, 0, 0, .2f * (1 - time / getLength())), 
			new Color(1, 0, 0, .8f * (1 - time / getLength()))});
	g.setPaint(grad);
	g.fill(bound);
}
 
开发者ID:Chroniaro,项目名称:What-Happened-to-Station-7,代码行数:15,代码来源:TileDamage.java

示例6: testSplash

import java.awt.Rectangle; //导入方法依赖的package包/类
static void testSplash(ImageInfo test) throws Exception {
    SplashScreen splashScreen = SplashScreen.getSplashScreen();

    if (splashScreen == null) {
        throw new RuntimeException("Splash screen is not shown!");
    }

    Graphics2D g = splashScreen.createGraphics();
    Rectangle splashBounds = splashScreen.getBounds();
    int screenX = (int) splashBounds.getCenterX();
    int screenY = (int) splashBounds.getCenterY();

    if(splashBounds.width != IMAGE_WIDTH){
        throw new RuntimeException(
                "SplashScreen#getBounds has wrong width");
    }
    if(splashBounds.height != IMAGE_HEIGHT){
        throw new RuntimeException(
                "SplashScreen#getBounds has wrong height");
    }

    Robot robot = new Robot();
    Color splashScreenColor = robot.getPixelColor(screenX, screenY);

    float scaleFactor = getScaleFactor();
    Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;

    if (!compare(testColor, splashScreenColor)) {
        throw new RuntimeException(
                "Image with wrong resolution is used for splash screen!");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:33,代码来源:MultiResolutionSplashTest.java

示例7: draw

import java.awt.Rectangle; //导入方法依赖的package包/类
@Override
public void draw(Graphics g, Rectangle bounds)
{
	// Make a few coordinate calculations
	Dimension totalTextSize = getTextArea(g);

	int maxTextStartX = (int) (bounds.getCenterX() - (totalTextSize.getWidth() / 2));
	int maxTextStartY = (int) (bounds.getCenterY() + (totalTextSize.getHeight() / 2));

	int boxStartY = maxTextStartY - (int) totalTextSize.getHeight() - PADDING_SIZE;
	int boxStartX = maxTextStartX - PADDING_SIZE;
	int boxWidth = (int) totalTextSize.getWidth() + (PADDING_SIZE * 2);
	int boxHeight = (int) totalTextSize.getHeight() + (PADDING_SIZE * 2);

	// Draw the box
	if( getHilight() != null )
	{
		g.setColor(getHilight());
		g.fillRect(boxStartX, boxStartY, boxWidth, boxHeight);
	}
	g.setColor(Color.BLACK);
	g.drawRect(boxStartX, boxStartY, boxWidth, boxHeight);

	// Draw the text
	Dimension textSize = getTextArea(g, displayName);
	int textX = (int) (bounds.getCenterX() - (textSize.getWidth() / 2));
	int textY = boxStartY + PADDING_SIZE + (int) textSize.getHeight();

	g.setFont(DEFAULT_FONT);
	g.drawString(displayName, textX, textY - 2);

	if( getMessage() != null )
	{
		textSize = getTextArea(g, getMessage());
		textX = (int) (bounds.getCenterX() - (textSize.getWidth() / 2));
		textY += NOTE_PADDING + (int) textSize.getHeight();

		g.setFont(NOTE_FONT);
		g.drawString(getMessage(), textX, textY - 2);
	}

	// Draw leading arrow
	drawLeadingInArrow(g, (int) bounds.getCenterX(), bounds.y, boxStartY - bounds.y);

	// Draw trailing arrow
	int arrowX = (int) bounds.getCenterX();
	int arrowY = boxStartY + boxHeight;
	int arrowLength = (bounds.y + bounds.height) - (boxStartY + boxHeight);
	drawLeadingOutArrow(g, arrowX, arrowY, arrowLength);
}
 
开发者ID:equella,项目名称:Equella,代码行数:51,代码来源:TaskRenderer.java


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