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


Java Graphics2D.getBackground方法代码示例

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


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

示例1: gInfo

import java.awt.Graphics2D; //导入方法依赖的package包/类
public gInfo(Graphics2D g)
{
	transform = g.getTransform();
	paint = g.getPaint();
	stroke = g.getStroke();
	font = g.getFont();
	composite = g.getComposite();
	bgrnd = g.getBackground();
	shape = g.getClip();
	hints = g.getRenderingHints();
}
 
开发者ID:Chroniaro,项目名称:What-Happened-to-Station-7,代码行数:12,代码来源:TStack.java

示例2: paint

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
public void paint(Graphics2D g, Shape alloc, Rectangle clipBounds) {
    Rectangle2D.Double allocBounds = ViewUtils.shape2Bounds(alloc);
    if (allocBounds.intersects(clipBounds)) {
        Font origFont = g.getFont();
        Color origColor = g.getColor();
        Color origBkColor = g.getBackground();
        Shape origClip = g.getClip();
        try {
            // Leave component font
            
            g.setBackground(getBackgroundColor());

            int xInt = (int) allocBounds.getX();
            int yInt = (int) allocBounds.getY();
            int endXInt = (int) (allocBounds.getX() + allocBounds.getWidth() - 1);
            int endYInt = (int) (allocBounds.getY() + allocBounds.getHeight() - 1);
            g.setColor(getBorderColor());
            g.drawRect(xInt, yInt, endXInt - xInt, endYInt - yInt);
            
            g.setColor(getForegroundColor());
            g.clearRect(xInt + 1, yInt + 1, endXInt - xInt - 1, endYInt - yInt - 1);
            g.clip(alloc);
            TextLayout textLayout = getTextLayout();
            if (textLayout != null) {
                EditorView.Parent parent = (EditorView.Parent) getParent();
                float ascent = parent.getViewRenderContext().getDefaultAscent();
                String desc = fold.getDescription(); // For empty desc a single-space text layout is returned
                float x = (float) (allocBounds.getX() + EXTRA_MARGIN_WIDTH);
                float y = (float) allocBounds.getY();
                if (desc.length() > 0) {
                    
                    textLayout.draw(g, x, y + ascent);
                }
            }
        } finally {
            g.setClip(origClip);
            g.setBackground(origBkColor);
            g.setColor(origColor);
            g.setFont(origFont);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:44,代码来源:FoldView.java


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