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


Java Graphics2D.draw3DRect方法代码示例

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


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

示例1: paintComponent

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
public void paintComponent(Graphics g) {
    super.paintComponent(g); //paint background

    Graphics2D Canvas = (Graphics2D) g;

    Canvas.setPaint(Color.BLACK);
    Canvas.draw3DRect(0, 0, getWidth() - 1, getHeight() - 1, true);

    if (getDiagrama() == null) {
        return;
    }

    int w = LarguraPagina;
    int h = AlturaPagina;

    if (!proporcionalLinha) {
        int nh = AlturaPagina;
        PinteNoArea(Canvas);

        for (int i = w; i < getWidth() + getColunas(); i += w) {
            Canvas.drawLine(i, 1, i, getHeight());
        }
        if (!isNaoConsiderarLinhasColunas()) {
            Canvas.setStroke(new BasicStroke(
                    1f,
                    BasicStroke.CAP_ROUND,
                    BasicStroke.JOIN_ROUND,
                    3f,
                    new float[]{2f, 1f},
                    0f));
        }
        for (int i = nh; i < getHeight() + getLinhas(); i += nh) {
            Canvas.drawLine(1, i, getWidth(), i);
        }
    } else {
        int nw = LarguraPagina;
        PinteNoArea(Canvas);

        for (int i = h; i < getHeight() + getLinhas(); i += h) {
            Canvas.drawLine(1, i, getWidth(), i);
        }
        if (!isNaoConsiderarLinhasColunas()) {
            Canvas.setStroke(new BasicStroke(
                    1f,
                    BasicStroke.CAP_ROUND,
                    BasicStroke.JOIN_ROUND,
                    3f,
                    new float[]{2f, 1f},
                    0f));
        }
        for (int i = nw; i < getWidth() + getColunas(); i += nw) {
            Canvas.drawLine(i, 1, i, getHeight());
        }
    }
    double z = (double) getWidth() / getDiagrama().getWidth();
    Canvas.scale(z, z);
    getDiagrama().ExternalPaint(g);
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:60,代码来源:Impressor.java

示例2: drawOverlay

import java.awt.Graphics2D; //导入方法依赖的package包/类
/**
 * Called from another thread, must be synchronized 
 */
@Override
public synchronized void drawOverlay(Graphics g, LevelScene levelScene, int playerIndex) {
	
	if(reservoirBars == null) {
		return;
	}
	if(agent != null && agent.getPlayerIndex() != GlobalOptions.playerGameWorldToDisplay) {
		return;
	}
	

	Image[] motivations= calculateImages();
	
	int imageSize = imageMaximumSize;
	int padding = 3;
	
	
	int boxWidth = (imageSize * motivations.length ) + (padding *  motivations.length );
	int boxHeight = (imageSize)+padding*2;
	
	int yTopleftCorner = GlobalOptions.yScreen -(boxHeight+1);
	int xTopleftCorner = 0;		
	

	
	Graphics2D g2d =(Graphics2D) g;

	
	
	
	g2d.setColor(new Color(255, 255, 255, 200));
	
	g2d.fill3DRect(xTopleftCorner,yTopleftCorner , boxWidth, boxHeight, true);
	g2d.setColor(Color.GRAY);
	g2d.draw3DRect(xTopleftCorner+1,yTopleftCorner+1 , boxWidth-1, boxHeight-1, true);
	

	g2d.setColor(null);
	for(int i = 0; i<motivations.length; i++) {
		
		int xOffset = (xTopleftCorner+ i*imageSize) +(  (boxWidth - (motivations.length*imageSize)) / motivations.length );
		int yOffset = (yTopleftCorner + ((boxHeight-motivations[i].getHeight(null))/2));
		g2d.drawImage(motivations[i], xOffset, yOffset, null);
	}
	
	

}
 
开发者ID:CognitiveModeling,项目名称:BrainControl,代码行数:52,代码来源:MotivationsOverlay.java


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