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


Java Graphics2D.fillRoundRect方法代码示例

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


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

示例1: paintBackground

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
protected void paintBackground(Graphics g) {
	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	g2.setColor(getComponent().getBackground());
	g2.fillRoundRect(0, 0, getComponent().getWidth(), getComponent().getHeight(),
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS, RapidLookAndFeel.CORNER_DEFAULT_RADIUS);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:10,代码来源:TextAreaUI.java

示例2: paintComponent

import java.awt.Graphics2D; //导入方法依赖的package包/类
/**
 * Over-painting component, so it can have different colors.
 */
@Override
public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g;

    g2d.setPaint(bkgColor);

    // draw the button rounded opaque
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // for high quality
    g2d.fillRoundRect(0, 0, getWidth(), getHeight(), 7, 7);

    // draw the border
    g2d.setColor(bkgColor.darker().darker());
    g2d.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 7, 7);
    super.paintComponent(g);
}
 
开发者ID:buni-rock,项目名称:Pixie,代码行数:20,代码来源:CustomColorButton.java

示例3: wrapMacFancy

import java.awt.Graphics2D; //导入方法依赖的package包/类
public static JPanel wrapMacFancy(JPanel content) {
	JPanel panel = new JPanel(new BorderLayout()) {

		private static final long serialVersionUID = 941275105778632480L;

		@Override
		public void paintComponent(Graphics g) {
			Color border = new Color(64, 64, 64, 64);
			Color bg = new Color(128, 128, 128, 64);

			Graphics2D g2 = (Graphics2D) g;
			g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
			g2.setColor(bg);
			g2.fillRoundRect(1, 1, this.getWidth()-2, this.getHeight()-2, 10, 10);
			g2.setColor(border);
			g2.drawRoundRect(0, 0, this.getWidth()-1, this.getHeight()-1, 10, 10);
		}
	};
	
	panel.setOpaque(false);
	content.setOpaque(false);
	panel.add(content, BorderLayout.CENTER);
	
	return panel;
}
 
开发者ID:CalebKussmaul,项目名称:GIFKR,代码行数:26,代码来源:ViewUtils.java

示例4: drawCursor

import java.awt.Graphics2D; //导入方法依赖的package包/类
/** dessine un cursseur dont le centre en X est centerX, et le centre en Y est centerY */
protected void drawCursor(final Graphics2D g2, final Color fillColor, final Color drawColor, final int centerX, final int centerY) {
    g2.setColor(fillColor);
    g2.fillRoundRect(centerX - CURSOR_W / 2, centerY - CURSOR_H / 2, CURSOR_W, CURSOR_H, ARC_SIZE, ARC_SIZE);

    g2.setColor(drawColor);
    g2.drawRoundRect(centerX - CURSOR_W / 2, centerY - CURSOR_H / 2, CURSOR_W, CURSOR_H, ARC_SIZE, ARC_SIZE);
}
 
开发者ID:iapafoto,项目名称:DicomViewer,代码行数:9,代码来源:AbstractSliderComponent.java

示例5: paint

import java.awt.Graphics2D; //导入方法依赖的package包/类
public void paint(Graphics2D g, StateColorMap colorMap) {
  Rectangle bounds = g.getClipBounds();
  if (startY > bounds.getMaxY() || startY + height < bounds.getMinY()) {
    return;
  }

  int x = line.getX();
  int width = line.getWidth();

  Color color = colorMap.getColor(stateName);
  g.setColor(color);
  g.fillRoundRect(x, startY, width, height, ARC_SIZE, ARC_SIZE);
  g.setColor(Color.BLACK);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:15,代码来源:LifelineState.java

示例6: drawCursor

import java.awt.Graphics2D; //导入方法依赖的package包/类
/** dessine un cursseur dont le centre en X est centerX, et le centre en Y est centerY */
public static void drawCursor(final Graphics2D g, final Color fillColor, final Color drawColor, final int centerX, final int centerY) {
    Graphics2D g2 = (Graphics2D) g.create();
    g2.setColor(fillColor);
    g2.fillRoundRect(centerX - CURSOR_W / 2, centerY - CURSOR_H / 2, CURSOR_W, CURSOR_H, ARC_SIZE, ARC_SIZE);

    g2.setColor(drawColor);
    g2.drawRoundRect(centerX - CURSOR_W / 2, centerY - CURSOR_H / 2, CURSOR_W, CURSOR_H, ARC_SIZE, ARC_SIZE);
    g2.dispose();
}
 
开发者ID:iapafoto,项目名称:DicomViewer,代码行数:11,代码来源:AbstractSliderComponentForTimeSlider.java

示例7: paint

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {
	Graphics2D g2 = (Graphics2D) g.create();
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	g2.setColor(getBackgroundColor());
	Rectangle rec = contentPanel.getBounds();
	g2.fillRoundRect((int) rec.getX(), (int) rec.getY(), rec.width + 15, rec.height, 25, 25);
	g2.setColor(SwingTools.RAPIDMINER_ORANGE);
	g2.drawRoundRect((int) rec.getX(), (int) rec.getY(), rec.width + 15, rec.height - 1, 25, 25);
	g2.dispose();
	super.paint(g, c);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:13,代码来源:PerspectivesPanelBar.java

示例8: PaintGradiente

import java.awt.Graphics2D; //导入方法依赖的package包/类
protected void PaintGradiente(Graphics2D g, boolean round) {
    int dist = 0;
    int w = getWidth() - dist;
    int h = getHeight() - dist;
    int L = getLeft();
    int T = getTop();
    boolean dv = getGDirecao() == VERTICAL;

    //Composite originalComposite = g.getComposite();
    //g.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_OVER, alfa));
    GradientPaint GP = new GradientPaint(L, T, getGradienteStartColor(), dv ? L : L + w, dv ? T + h : T, getGradienteEndColor(), true);
    //g.setPaint(GP);

    g.setPaint(getForeColor());
    if (round) {
        g.drawRoundRect(L, T, w - 1, h - 1, roundRectSize, roundRectSize);
        g.setPaint(GP);
        g.fillRoundRect(L + 1, T + 1, w - 2, h - 2, roundRectSize, roundRectSize);
        g.setPaint(isDisablePainted()? disabledColor : Color.WHITE);
        g.drawRoundRect(L + 1, T + 1, w - 3, h - 3, roundRectSize, roundRectSize);
    } else {
        g.drawRect(L, T, w - 1, h - 1);
        g.setPaint(GP);
        g.fillRect(L + 1, T + 1, w - 2, h - 2);
        g.setPaint(isDisablePainted()? disabledColor : Color.WHITE);
        g.drawRect(L + 1, T + 1, w - 3, h - 3);
    }
    if (isGradientePinteDetalhe()) {
        g.setPaint(getGradienteCorDetalhe());
        GeneralPath path = new GeneralPath();
        path.moveTo(L + 2, T + 2);
        path.quadTo(L + w / 2 + 1, T + h / 2 + 1, L + w - 1, T + 2);
        path.closePath();
        g.fill(path);
    }
    //g.setComposite(originalComposite);

}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:39,代码来源:PreTexto.java

示例9: paintComponent

import java.awt.Graphics2D; //导入方法依赖的package包/类
public void paintComponent(Graphics graphics) 
{
	int h = getHeight();
	int w =  getWidth();
	
	if (h < GRADIENT_EXTENT + 1) 
	{
		super.paintComponent(graphics);
		return;
	}
	
	float percentageOfGradient = (float) GRADIENT_EXTENT / h;
	
	if (percentageOfGradient > 0.49f)
	{
		percentageOfGradient = 0.49f;
	}
	
	Graphics2D graphics2D = (Graphics2D) graphics;
	
	float fractions[] = new float[] 
	{ 
		0, percentageOfGradient, 1 - percentageOfGradient, 1f 
	};
	
	Color colors[] = new Color[] 
	{ 
		colorLow, colorHigh, colorHigh, colorLow 
	};
	
	LinearGradientPaint paint = new LinearGradientPaint(0, 0, 0, h - 1, fractions, colors);
	
	graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	graphics2D.setPaint(paint);
	graphics2D.fillRoundRect(0, 0, w - 1, h - 1, GRADIENT_EXTENT, GRADIENT_EXTENT);
	graphics2D.setColor(colorBorder);
	graphics2D.setStroke(edgeStroke);
	graphics2D.drawRoundRect(0, 0, w - 1, h - 1, GRADIENT_EXTENT, GRADIENT_EXTENT);
}
 
开发者ID:ca333,项目名称:komodoGUI,代码行数:40,代码来源:PresentationPanel.java

示例10: drawFlagImage

import java.awt.Graphics2D; //导入方法依赖的package包/类
public void drawFlagImage(Graphics2D g) {
  final int tabHeight = 15;
  final int tabWidth = 10;
  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  g.setColor(background);
  g.fillRoundRect(-tabWidth, 0, 2*tabWidth, tabHeight, 6, 6);
  g.setColor(foreground);
  g.drawRoundRect(-tabWidth, 0, 2*tabWidth-1, tabHeight-1, 6, 6);
  g.setFont(new Font("Dialog", Font.PLAIN, 9));
  Rectangle2D r = g.getFontMetrics().getStringBounds(name, g);
  g.drawString(name, tabWidth/2 - (int) (r.getWidth()/2.0) - 1, 11);
  g.setBackground(new Color(0,0,0,0));
  g.clearRect(-tabWidth, 0, tabWidth, tabHeight);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:16,代码来源:ADC2Module.java

示例11: paintBorder

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    Dimension arcs = new Dimension(40, 40);
    Graphics2D graphics = (Graphics2D) g;
    graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    graphics.setColor(new Color(106, 117, 144));
    graphics.fillRoundRect(0, 0, width - 1, height - 1, arcs.width, arcs.height);//paint background

    graphics.setClip(null);
    graphics.drawRoundRect(0, 0, width - 1, height - 1, arcs.width, arcs.height);//paint border
}
 
开发者ID:PanagiotisDrakatos,项目名称:EasyDragDrop,代码行数:13,代码来源:MainFrame.java

示例12: paint

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

	//super.paintComponent(g);
	
	Color borderColor= !isEnabled() ? new Color(200,200,200,255) : new Color(0,110,198,255);
	Color fontColor=getForeground();
	
	int maxwidth=super.getWidth();
	int maxheight=super.getHeight();
	int marginleft=(super.getWidth()-maxwidth)/2;
	int margintop=(super.getHeight()-maxheight)/2;

	Graphics2D g2=(Graphics2D) g;
	
    g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    g2.setColor(borderColor);
    
	g2.fillRoundRect(marginleft, margintop, maxwidth, maxheight, 6, 6);
	/*
	g2.setColor(borderColor.brighter());
	g2.setStroke(new BasicStroke(2));
	g2.drawRoundRect(marginleft, margintop, maxwidth-1, maxheight-1, 6, 6);
	
	g2.setColor(borderColor.darker());
	g2.setStroke(new BasicStroke(1));
	g2.drawRoundRect(marginleft, margintop, maxwidth-1, maxheight-1, 6, 6);
	*/
	g2.setColor(fontColor);
	g2.setFont(getFont());
	g2.drawString(getText(), (getWidth()-g.getFontMetrics().stringWidth(getText()))/2, g.getFontMetrics().getAscent()+(getHeight()-g.getFontMetrics().getAscent())/2);
	
	
}
 
开发者ID:davovoid,项目名称:faitic-checker,代码行数:38,代码来源:JCustomButton.java

示例13: paintDeterminate

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
protected void paintDeterminate(Graphics g, JComponent c) {
	boolean compressed = Boolean.parseBoolean(String.valueOf(progressBar
			.getClientProperty(RapidLookTools.PROPERTY_PROGRESSBAR_COMPRESSED)));

	int y = 0;
	int x = 0;
	int w;
	int h;
	if (compressed) {
		x = (int) (c.getWidth() * 0.67);
		w = (int) (c.getWidth() * 0.33);
		y = 3;
		h = c.getHeight() - 6;
	} else {
		w = c.getWidth();
		h = c.getHeight() / 2;
	}

	int amountFull = getAmountFull(progressBar.getInsets(), w, h);

	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	if (c.isOpaque()) {
		if (c.getParent() != null) {
			g2.setColor(c.getParent().getBackground());
		} else {
			g2.setColor(c.getBackground());
		}
		g2.fillRect(x, y, c.getWidth(), c.getHeight());
	}

	g2.setColor(Colors.PROGRESSBAR_BACKGROUND);
	g2.fillRoundRect(x + 1, y + 1, w - 2, h - 2, RapidLookAndFeel.CORNER_DEFAULT_RADIUS,
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS);

	g2.setColor(Colors.PROGRESSBAR_BORDER);
	g2.drawRoundRect(x + 1, y + 1, w - 2, h - 2, RapidLookAndFeel.CORNER_DEFAULT_RADIUS,
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS);

	Paint gp = new GradientPaint(x, y + 3, Colors.PROGRESSBAR_DETERMINATE_FOREGROUND_GRADIENT_START, x, h - 5,
			Colors.PROGRESSBAR_DETERMINATE_FOREGROUND_GRADIENT_END);
	g2.setPaint(gp);
	g2.fillRoundRect(x + 3, y + 3, amountFull - 5, h - 5, RapidLookAndFeel.CORNER_DEFAULT_RADIUS / 2,
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS / 2);

	drawString(g2, w, h, compressed);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:50,代码来源:ProgressBarUI.java

示例14: paintIndeterminate

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
protected void paintIndeterminate(Graphics g, JComponent c) {
	boolean compressed = Boolean.parseBoolean(String.valueOf(progressBar
			.getClientProperty(RapidLookTools.PROPERTY_PROGRESSBAR_COMPRESSED)));

	int y = 0;
	int x = 0;
	int w;
	int h;
	if (compressed) {
		x = (int) (c.getWidth() * 0.67);
		w = (int) (c.getWidth() * 0.33);
		y = 3;
		h = c.getHeight() - 6;
	} else {
		w = c.getWidth();
		h = c.getHeight() / 2;
	}

	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	if (c.isOpaque()) {
		if (c.getParent() != null) {
			g2.setColor(c.getParent().getBackground());
		} else {
			g2.setColor(c.getBackground());
		}
		g2.fillRect(x, y, c.getWidth(), c.getHeight());
	}

	g2.setColor(Colors.PROGRESSBAR_BACKGROUND);
	g2.fillRoundRect(x + 1, y + 1, w - 2, h - 2, RapidLookAndFeel.CORNER_DEFAULT_RADIUS,
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS);

	g2.setColor(Colors.PROGRESSBAR_BORDER);
	g2.drawRoundRect(x + 1, y + 1, w - 2, h - 2, RapidLookAndFeel.CORNER_DEFAULT_RADIUS,
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS);

	// make sure we don't draw over the boundaries
	RoundRectangle2D clipRect = new RoundRectangle2D.Double(x + 3, y + 3, w - 5, h - 5,
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS / 2, RapidLookAndFeel.CORNER_DEFAULT_RADIUS / 2);
	g2.setClip(clipRect);

	for (double xCoord = x + -4 * ANIMATION_BAR_LENGTH + System.currentTimeMillis() * ANIMATION_SPEED
			% (2 * ANIMATION_BAR_LENGTH); xCoord < x + w + 2 * ANIMATION_BAR_LENGTH;) {
		g2.setColor(Colors.PROGRESSBAR_INDETERMINATE_FOREGROUND_1);
		g2.fill(createIntermediateShape(xCoord, ANIMATION_BAR_LENGTH, h));
		xCoord += ANIMATION_BAR_LENGTH;
		g2.setColor(Colors.PROGRESSBAR_INDETERMINATE_FOREGROUND_2);
		g2.fill(createIntermediateShape(xCoord, ANIMATION_BAR_LENGTH, h));
		xCoord += ANIMATION_BAR_LENGTH;
	}
	g2.setClip(null);

	drawString(g2, w, h, compressed);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:58,代码来源:ProgressBarUI.java

示例15: paintComponent

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

	Graphics2D g2=(Graphics2D) g;

	g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
	g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	g2.setColor(iBorderColor);
	g2.fillRoundRect(0, 0, getWidth(), getHeight(), 6, 6);

	g2.setColor(Color.white);
	g2.fillRoundRect(1, 1, getWidth()-2, getHeight()-2, 4, 4);

	super.paintComponent(g);

}
 
开发者ID:davovoid,项目名称:faitic-checker,代码行数:19,代码来源:JCustomPasswordField.java


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