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


Java Graphics.hitClip方法代码示例

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


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

示例1: paint

import java.awt.Graphics; //导入方法依赖的package包/类
/**
 * 
 */
public void paint(Graphics g) {
  Graphics2D g2 = (Graphics2D) g;

  Stroke stroke = g2.getStroke();
  g2.setStroke(getSelectionStroke());
  g.setColor(getSelectionColor());

  Point last = state.getAbsolutePoint(0).getPoint();

  for (int i = 1; i < state.getAbsolutePointCount(); i++) {
    Point current = state.getAbsolutePoint(i).getPoint();
    Line2D line = new Line2D.Float(last.x, last.y, current.x, current.y);

    Rectangle bounds = g2.getStroke().createStrokedShape(line).getBounds();

    if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height)) {
      g2.draw(line);
    }

    last = current;
  }

  g2.setStroke(stroke);
  super.paint(g);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:29,代码来源:mxEdgeHandler.java

示例2: paint

import java.awt.Graphics; //导入方法依赖的package包/类
/**
 * 
 */
public void paint(Graphics g)
{
	Rectangle bounds = getState().getRectangle();

	if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height))
	{
		Graphics2D g2 = (Graphics2D) g;

		Stroke stroke = g2.getStroke();
		g2.setStroke(getSelectionStroke());
		g.setColor(getSelectionColor());
		g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);
		g2.setStroke(stroke);
	}

	super.paint(g);
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:21,代码来源:mxVertexHandler.java

示例3: paint

import java.awt.Graphics; //导入方法依赖的package包/类
/**
 * Paints the visible handles of this handler.
 */
public void paint(Graphics g)
{
	if (handles != null && isHandlesVisible())
	{
		for (int i = 0; i < handles.length; i++)
		{
			if (isHandleVisible(i)
					&& g.hitClip(handles[i].x, handles[i].y,
							handles[i].width, handles[i].height))
			{
				g.setColor(getHandleFillColor(i));
				g.fillRect(handles[i].x, handles[i].y, handles[i].width,
						handles[i].height);

				g.setColor(getHandleBorderColor(i));
				g.drawRect(handles[i].x, handles[i].y,
						handles[i].width - 1, handles[i].height - 1);
			}
		}
	}
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:25,代码来源:mxCellHandler.java

示例4: paint

import java.awt.Graphics; //导入方法依赖的package包/类
/**
 * 
 */
public void paint(Graphics g) {
  Rectangle bounds = getState().getRectangle();

  if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height)) {
    Graphics2D g2 = (Graphics2D) g;

    Stroke stroke = g2.getStroke();
    g2.setStroke(getSelectionStroke());
    g.setColor(getSelectionColor());
    g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);
    g2.setStroke(stroke);
  }

  super.paint(g);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:19,代码来源:mxVertexHandler.java

示例5: paintMargin

import java.awt.Graphics; //导入方法依赖的package包/类
/** Paint the outside margin where the spinners for expandable
 *  sets are.  This should be derived from the standard control
 *  color.  This method will overpaint the grid lines in this
 *  area.    */
private void paintMargin(Graphics g) {
    //Don't paint the margin for sorted modes
    //fill the outer column with the set renderer color, per UI spec
    g.setColor(PropUtils.getSetRendererColor());

    int w = PropUtils.getMarginWidth();
    int h = getHeight();

    if (g.hitClip(0, 0, w, h)) {
        g.fillRect(0, 0, w, h);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:SheetTable.java

示例6: paint

import java.awt.Graphics; //导入方法依赖的package包/类
public void paint(Graphics g) {
    if (isShowing()) {
        super.paint(g);
    } else {
        getLayout().layoutContainer(this);

        Component[] c = getComponents();
        Color col = g.getColor();

        try {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());

            for (int i = 0; i < c.length; i++) {
                Rectangle r = c[i].getBounds();

                if (g.hitClip(r.x, r.y, r.width, r.height)) {
                    Graphics g2 = g.create(r.x, r.y, r.width, r.height);

                    try {
                        c[i].paint(g2);
                    } finally {
                        g2.dispose();
                    }
                }
            }

            if (getBorder() != null) {
                super.paintBorder(g);
            }
        } finally {
            g.setColor(col);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:RadioInplaceEditor.java

示例7: paint

import java.awt.Graphics; //导入方法依赖的package包/类
/** Overridden to draw "no properties" if necessary */
public void paint(Graphics g, JComponent c) {
    Component view = ((JViewport) c).getView();

    if (view != null) {
        lastKnownSize = view.getSize();
    }

    if (stringWidth == -1) {
        calcStringSizes(c.getFont(), g);
    }

    //Update will have set paintNoProps to the correct value
    if (shouldPaintEmptyMessage()) {
        //We need to paint centered "<No Properties>" text
        g.setFont(c.getFont());
        g.setColor(c.getForeground());

        Rectangle r = getEmptyMessageBounds();

        //See if we really need to do any painting
        if (g.hitClip(r.x, r.y, r.width, r.height)) {
            //Paint the string
            g.drawString(emptyString, r.x, r.y + ascent);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:MarginViewportUI.java

示例8: paint

import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {

    ColorUtil.setupAntialiasing(g);

    TabData tabData;
    int x, y, width, height;
    String text;
    
    paintDisplayerBackground( g, c );

    for (int i = 0; i < dataModel.size(); i++) {
        // gather data
        tabData = dataModel.getTab(i);
        x = layoutModel.getX(i);
        y = layoutModel.getY(i);
        width = layoutModel.getW(i);
        height = layoutModel.getH(i);
        text = tabData.getText();
        // perform paint
        if (g.hitClip(x, y, width, height)) {
            paintTabBackground(g, i, x, y, width, height);
            paintTabContent(g, i, text, x, y, width, height);
            paintTabBorder(g, i, x, y, width, height);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:AbstractViewTabDisplayerUI.java

示例9: paint

import java.awt.Graphics; //导入方法依赖的package包/类
/**
 * 
 */
public void paint(Graphics g)
{
	Graphics2D g2 = (Graphics2D) g;

	Stroke stroke = g2.getStroke();
	g2.setStroke(getSelectionStroke());
	g.setColor(getSelectionColor());

	Point last = state.getAbsolutePoint(0).getPoint();

	for (int i = 1; i < state.getAbsolutePointCount(); i++)
	{
		Point current = state.getAbsolutePoint(i).getPoint();
		Line2D line = new Line2D.Float(last.x, last.y, current.x, current.y);

		Rectangle bounds = g2.getStroke().createStrokedShape(line)
				.getBounds();

		if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height))
		{
			g2.draw(line);
		}

		last = current;
	}

	g2.setStroke(stroke);
	super.paint(g);
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:33,代码来源:mxEdgeHandler.java

示例10: paint

import java.awt.Graphics; //导入方法依赖的package包/类
/**
 * Paints the visible handles of this handler.
 */
public void paint(Graphics g) {
  if (handles != null && isHandlesVisible()) {
    for (int i = 0; i < handles.length; i++) {
      if (isHandleVisible(i)
          && g.hitClip(handles[i].x, handles[i].y, handles[i].width, handles[i].height)) {
        g.setColor(getHandleFillColor(i));
        g.fillRect(handles[i].x, handles[i].y, handles[i].width, handles[i].height);

        g.setColor(getHandleBorderColor(i));
        g.drawRect(handles[i].x, handles[i].y, handles[i].width - 1, handles[i].height - 1);
      }
    }
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:mxCellHandler.java

示例11: paintExpandableSets

import java.awt.Graphics; //导入方法依赖的package包/类
/** Paint the expandable sets.  These are painted double width,
 *  across the entire width of the table. */
private void paintExpandableSets(Graphics g) {
    int start = 0;
    int end = getRowCount();

    Insets ins = getInsets();

    boolean canBeSelected = isKnownComponent(
            KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner()
        );

    for (int i = 0; i < end; i++) {
        int idx = start + i;
        Object value = getValueAt(idx, 0);

        if (value instanceof PropertySet) {
            Rectangle r = getCellRect(idx, 0, false);
            r.x = ins.left;
            r.width = getWidth() - (ins.left + ins.right);

            if (g.hitClip(r.x, r.y, r.width, r.height)) {
                PropertySet ps = (PropertySet) value;

                String txt = ps.getHtmlDisplayName();
                boolean isHtml = txt != null;

                if (!isHtml) {
                    txt = ps.getDisplayName();
                }

                if (htmlrenderer == null) {
                    htmlrenderer = HtmlRenderer.createRenderer();
                }

                JComponent painter = (JComponent) htmlrenderer.getTableCellRendererComponent(
                        this, txt, false, false, idx, 0
                    );

                htmlrenderer.setHtml(isHtml);
                htmlrenderer.setParentFocused(true);

                htmlrenderer.setIconTextGap(2);

                htmlrenderer.setIcon(
                    getPropertySetModel().isExpanded(ps) ? PropUtils.getExpandedIcon() : PropUtils.getCollapsedIcon()
                );

                boolean selected = canBeSelected && (getSelectedRow() == idx);

                if (!selected) {
                    painter.setBackground(PropUtils.getSetRendererColor());
                    painter.setForeground(PropUtils.getSetForegroundColor());
                } else {
                    painter.setBackground(PropUtils.getSelectedSetRendererColor());
                    painter.setForeground(PropUtils.getSelectedSetForegroundColor());
                }

                if( PropUtils.isAqua ) {
                    painter.setOpaque(false);
                    Graphics2D g2d = (Graphics2D) g;
                    Paint oldPaint = g2d.getPaint();
                    g2d.setPaint( new GradientPaint(r.x,r.y, Color.white, r.x, r.y+r.height/2, painter.getBackground()) );
                    g2d.fillRect(r.x, r.y, r.width, r.height);
                    g2d.setPaint(oldPaint);
                } else {
                    painter.setOpaque(true);
                }

                paintComponent(g, painter, r.x, r.y, r.width, r.height);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:75,代码来源:SheetTable.java


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