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


Java RoundRectangle2D.Double方法代码示例

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


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

示例1: paintComponent

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
/**
 * Draws the component background.
 *
 * @param g
 *            the graphics context
 */
void paintComponent(Graphics g) {
	RectangularShape rectangle;
	int radius = RapidLookAndFeel.CORNER_DEFAULT_RADIUS;
	switch (position) {
		case SwingConstants.LEFT:
			rectangle = new RoundRectangle2D.Double(0, 0, button.getWidth() + radius, button.getHeight(), radius,
					radius);
			break;
		case SwingConstants.CENTER:
			rectangle = new Rectangle2D.Double(0, 0, button.getWidth(), button.getHeight());
			break;
		default:
			rectangle = new RoundRectangle2D.Double(-radius, 0, button.getWidth() + radius, button.getHeight(), radius,
					radius);
			break;
	}
	RapidLookTools.drawButton(button, g, rectangle);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:25,代码来源:CompositeButtonPainter.java

示例2: paint

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

    g.setColor(function.getBackground());
    final Rectangle2D rect = movingArea.getBounds(getBounds());

    RoundRectangle2D.Double rec = new RoundRectangle2D.Double(rect.getX(),
            rect.getY(), rect.getWidth(), rect.getHeight(),
            movingArea.getIDoubleOrdinate(4),
            movingArea.getIDoubleOrdinate(4));

    g.fill(rec);
    g.setFont(function.getFont());
    paintText(g);

    paintBorder(g);

    final Stroke tmp = g.getStroke();
    g.draw(rec);
    g.setStroke(tmp);
    paintTringle(g);

}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:24,代码来源:DFDSRole.java

示例3: DisplayNode

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
public DisplayNode() {
    super();
    
    PText labelNode = new PText( PHScaleStrings.LABEL_PH );
    labelNode.setFont( DISPLAY_FONT );
    
    _valueNode = new PText( "XXX.XX" );
    _valueNode.setFont( DISPLAY_FONT );
    
    PComposite parentNode = new PComposite();
    parentNode.addChild( labelNode );
    parentNode.addChild( _valueNode );
    labelNode.setOffset( 0, 0 );
    _valueNode.setOffset( labelNode.getFullBoundsReference().getWidth() + DISPLAY_X_SPACING, 0 );
    
    PBounds pb = parentNode.getFullBoundsReference();
    Shape backgroundShape = new RoundRectangle2D.Double( 0, 0, pb.getWidth() + 2 * DISPLAY_BORDER_MARGIN, pb.getHeight() + 2 * DISPLAY_BORDER_MARGIN, 10, 10 );
    PPath backgroundNode = new PPath( backgroundShape );
    addChild( backgroundNode );
    backgroundNode.setPaint( DISPLAY_BACKGROUND );
    backgroundNode.setStroke( new BasicStroke( (float) DISPLAY_BORDER_WIDTH ) );
    backgroundNode.setStrokePaint( DISPLAY_BORDER_COLOR );
    backgroundNode.addChild( parentNode );
    parentNode.setOffset( DISPLAY_BORDER_MARGIN, DISPLAY_BORDER_MARGIN );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:ProbeNode.java

示例4: paintButton

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
private void paintButton(Graphics g, Color[] colors) {
	
	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	int width = this.getWidth();
	int height = this.getHeight();

	Point2D center = new Point2D.Float(width / 2, height / 2);
	float radius = width / 2;
	float[] dist = { 0.0f, 0.8f };
	RadialGradientPaint paint = new RadialGradientPaint(center, radius, dist, colors);
	g2.setPaint(paint);
	shape = new RoundRectangle2D.Double(0, 0, width, height, height, height);
	g2.fill(shape);

	Font defaultFont = getFont();
	g2.setFont(defaultFont);
	g2.setColor(Color.BLACK);
	Rectangle2D rect = defaultFont.getStringBounds(text, g2.getFontRenderContext());
	LineMetrics lineMetrics = defaultFont.getLineMetrics(text, g2.getFontRenderContext());
	g2.drawString(text, (float) (width / 2 - rect.getWidth() / 2), (float) ((height / 2)
			+ ((lineMetrics.getAscent() + lineMetrics.getDescent()) / 2 - lineMetrics.getDescent())));

}
 
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:25,代码来源:MyButton.java

示例5: paintButton

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
private void paintButton(Graphics g, Color[] colors)
{
    Graphics2D g2 = (Graphics2D)g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    int width = this.getWidth();
    int height = this.getHeight();

    Point2D center = new Point2D.Float(width / 2, height / 2);
    float radius = width / 2;
    float[] dist = {0.0f, 0.8f};
    RadialGradientPaint paint = new RadialGradientPaint(center, radius, dist, colors);
    g2.setPaint(paint);
    shape = new RoundRectangle2D.Double(0, 0, width, height, height, height);
    g2.fill(shape);

    Font defaultFont = getFont();
    g2.setFont(defaultFont);
    g2.setColor(Color.BLACK);
    Rectangle2D rect = defaultFont.getStringBounds(text, g2.getFontRenderContext());
    LineMetrics lineMetrics = defaultFont.getLineMetrics(text, g2.getFontRenderContext());
    g2.drawString(text,
        (float)(width / 2 - rect.getWidth() / 2),
        (float)((height / 2) + ((lineMetrics.getAscent() + lineMetrics.getDescent()) / 2 - lineMetrics.getDescent())));

}
 
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:26,代码来源:CTDFrame.java

示例6: setLocation

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
/**
 * Sets the location, relative to the upper-left corner of the bounding box
 * that encloses all of the pipe segements.
 * 
 * @param location the location
 */
public void setLocation( Point location ) {
    int dx = location.x - _location.x;
    int dy = location.y - _location.y;

    _location = location;

    RoundRectangle2D.Double r;
    for( int i = 0; i < _pipes.size(); i++ ) {
        r = (RoundRectangle2D.Double) _pipes.get( i );
        r.x += dx;
        r.y += dy;
    }

    updateShape();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:PipeGraphic.java

示例7: DigitalReadoutNode

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
/**
 * Constructor.
 *
 * @param width
 * @param temperatureUnits
 */
public DigitalReadoutNode( double width, TemperatureUnits temperatureUnits ) {
    double height = width / WIDTH_TO_HEIGHT_RATIO;
    PPath backgroundNode = new PPath( new RoundRectangle2D.Double( 0, 0, width, height, height / 5, height / 5 ) );
    backgroundNode.setPaint( BACKGROUND_COLOR );
    addChild( backgroundNode );

    double borderWidth = width * ( 1 - INSET_WIDTH_RATIO );
    m_foregroundNode = new PPath( new RoundRectangle2D.Double( 0, 0, width - ( borderWidth * 2 ),
                                                               height - ( borderWidth * 2 ), height / 5, height / 5 ) );
    m_foregroundNode.setPaint( FOREGROUND_COLOR );
    addChild( m_foregroundNode );
    m_foregroundNode.setOffset( borderWidth, borderWidth );

    m_text = new PText( "0" );
    m_text.setFont( new PhetFont( 12, true ) );
    m_defaultTextScale = m_foregroundNode.getFullBoundsReference().height * 0.8 / m_text.getFullBoundsReference().height;
    addChild( m_text );

    setTemperatureUnits( temperatureUnits );
    update();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:28,代码来源:CompositeThermometerNode.java

示例8: TimeDisplayNode

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
TimeDisplayNode() {
    _readoutWidth = _usableWidth * 0.22;   // Somewhat arbitrary default values, size is expected to be set through method.
    _readoutHeight = _usableHeight * 0.2;  // Somewhat arbitrary default values, size is expected to be set through method.
    _backgroundShape = new RoundRectangle2D.Double( 0, 0, _readoutWidth, _readoutHeight, 8, 8 );
    _background = new PPath( _backgroundShape );
    _background.setPaint( BACKGROUND_COLOR );
    addChild( _background );
    _timeText = new HTMLNode();
    _timeText.setFont( TIME_FONT );
    addChild( _timeText );
    _spaceText = new PText( " " );
    _spaceText.setFont( TIME_FONT );
    addChild( _spaceText );
    _unitsText = new HTMLNode();
    _unitsText.setFont( TIME_FONT );
    addChild( _unitsText );
    _dummyTextNormal = new HTMLNode( _timeFormatterNoDecimals.format( 9999 ) );
    _dummyTextNormal.setFont( TIME_FONT );
    _dummyTextExponential = new HTMLNode( _trillionsFormatter.format( 999E12 ) );
    _dummyTextExponential.setFont( TIME_FONT );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:SingleNucleusDecayTimeChart.java

示例9: paintIcon

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
  if (myColor.getAlpha() != 0xff) {
    final RoundRectangle2D.Double clip =
      new RoundRectangle2D.Double(x, y, myCellSize, myCellSize, ARC_SIZE, ARC_SIZE);
    GraphicsUtil.paintCheckeredBackground(g, clip);
  }

  g.setColor(myColor);
  g.fillRoundRect(x, y, myCellSize, myCellSize, ARC_SIZE, ARC_SIZE);

  myColor.getRGBComponents(myRgbaArray);
  if (Math.pow(1.0 - myRgbaArray[0], 2) + Math.pow(1.0 - myRgbaArray[1], 2) + Math.pow(1.0 - myRgbaArray[2], 2) < THRESHOLD_SQUARED_DISTANCE) {
    // Drawing a border to avoid displaying white boxes on a white background
    g.setColor(Gray._239);
    g.drawRoundRect(x, y, myCellSize, myCellSize - 1, ARC_SIZE, ARC_SIZE);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ColorComponent.java

示例10: createShapeForButton

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
/**
 * Creates the default {@link Shape} for the given button.
 *
 * @param b
 *            the button to create the shape for
 * @return the shape instance
 */
public static Shape createShapeForButton(AbstractButton b) {
	int w = b.getWidth();
	int h = b.getHeight();

	return new RoundRectangle2D.Double(1, 1, w - 2, h - 2, RapidLookAndFeel.CORNER_DEFAULT_RADIUS,
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:15,代码来源:RapidLookTools.java

示例11: createBorderShapeForButton

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
/**
 * Creates the border {@link Shape} for the given button.
 *
 * @param b
 *            the button to create the border shape for
 * @return the border shape instance
 */
public static Shape createBorderShapeForButton(AbstractButton b) {
	int w = b.getWidth();
	int h = b.getHeight();

	return new RoundRectangle2D.Double(0, 0, w - 1, h - 1, RapidLookAndFeel.CORNER_DEFAULT_RADIUS,
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:15,代码来源:RapidLookTools.java

示例12: renderOperatorBackground

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
/**
 * Draws the operator background (white round rectangle).
 *
 * @param operator
 *            the operator to draw the background for
 * @param g2
 *            the graphics context to draw upon
 */
private void renderOperatorBackground(final Operator operator, final Graphics2D g2) {
	Rectangle2D frame = model.getOperatorRect(operator);
	// the first paint can come before any of the operator register listeners fire
	// thus we need to check the rect for null and set it here once
	// all subsequent calls will then have a valid rect
	if (frame == null) {
		return;
	}

	RoundRectangle2D background = new RoundRectangle2D.Double(frame.getX() - 7, frame.getY() - 3, frame.getWidth() + 14,
			frame.getHeight() + 11, OPERATOR_BG_CORNER, OPERATOR_BG_CORNER);
	g2.setColor(Color.WHITE);
	g2.fill(background);

	// if name is wider than operator, extend white background for header
	Rectangle2D nameBounds = OPERATOR_FONT.getStringBounds(operator.getName(), g2.getFontRenderContext());
	if (nameBounds.getWidth() > frame.getWidth()) {
		double relevantWidth = Math.min(nameBounds.getWidth(), frame.getWidth() * MAX_HEADER_RATIO);
		double offset = (frame.getWidth() - relevantWidth) / 2;
		int x = (int) (frame.getX() + offset);

		int padding = 5;
		RoundRectangle2D nameBackground = new RoundRectangle2D.Double(
				(int) Math.min(frame.getX() - padding, x - padding), frame.getY() - 3, relevantWidth + 2 * padding,
				ProcessRendererModel.HEADER_HEIGHT + 3, OPERATOR_BG_CORNER, OPERATOR_BG_CORNER);
		g2.fill(nameBackground);
	}

	// render ports
	renderPortsBackground(operator.getInputPorts(), g2);
	renderPortsBackground(operator.getOutputPorts(), g2);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:41,代码来源:ProcessDrawer.java

示例13: drawDragBorder

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
/**
 * Draws the drag border.
 *
 * @param process
 *            the process for which to render the background
 * @param g2
 *            the graphics context to draw upon
 */
private void drawDragBorder(final ExecutionUnit process, final Graphics2D g2) {
	double width = model.getProcessWidth(process);
	double height = model.getProcessHeight(process);
	Shape dragFrame = new RoundRectangle2D.Double(DRAG_BORDER_PADDING, DRAG_BORDER_PADDING, width - 2
			* DRAG_BORDER_PADDING, height - 2 * DRAG_BORDER_PADDING, DRAG_BORDER_CORNER, DRAG_BORDER_CORNER);
	g2.setColor(BORDER_DRAG_COLOR);
	g2.setStroke(BORDER_DRAG_STROKE);
	g2.draw(dragFrame);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:18,代码来源:ProcessDrawer.java

示例14: drawViewButton

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
private RoundRectangle2D drawViewButton(double x, double y, Graphics2D g2d, boolean draw, boolean clicked) {
	Rectangle2D dvR;
	RoundRectangle2D dvRR;
	Color tmp;
	Color fg = Color.BLACK;
	Color bg = Color.LIGHT_GRAY;

	if (clicked) {
		tmp = fg;
		fg = bg;
		bg = tmp;
	}

	if (nCpu > 2) {
		fg = Color.DARK_GRAY.brighter().brighter();
		bg = Color.LIGHT_GRAY;
	}

	dvR = drawCenteredText("change view", fg, bg, x, y, g2d, false, false);
	dvRR = new RoundRectangle2D.Double(x, y, dvR.getWidth(), dvR.getHeight(), 5.0, 5.0);
	if (draw) {
		tmp = g2d.getColor();
		g2d.setColor(bg);
		g2d.fill(dvRR);
		g2d.setColor(fg);
		g2d.draw(dvRR);
		drawCenteredText("change view", fg, bg, x + dvR.getWidth() / 2.0, y + dvR.getHeight() / 2.0, g2d, false, true);
		g2d.setColor(tmp);
	}
	return dvRR;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:32,代码来源:QueueDrawer.java

示例15: drawViewButton

import java.awt.geom.RoundRectangle2D; //导入方法依赖的package包/类
private RoundRectangle2D drawViewButton(double x, double y, Graphics2D g2d, boolean draw, boolean clicked) {
	Rectangle2D dvR;
	RoundRectangle2D dvRR;
	Color tmp;
	Color fg = Color.BLACK;
	Color bg = Color.LIGHT_GRAY;

	if (clicked) {
		tmp = fg;
		fg = bg;
		bg = tmp;
	}

	if (nCpu > 2) {
		fg = Color.darkGray.brighter().brighter();
		bg = Color.LIGHT_GRAY;
	}

	dvR = drawCenteredText("change view", fg, bg, x, y, g2d, false, false);
	dvRR = new RoundRectangle2D.Double(x, y, dvR.getWidth(), dvR.getHeight(), 5.0, 5.0);
	if (draw) {
		tmp = g2d.getColor();
		g2d.setColor(bg);
		g2d.fill(dvRR);
		g2d.setColor(fg);
		g2d.draw(dvRR);
		drawCenteredText("change view", fg, bg, x + dvR.getWidth() / 2.0, y + dvR.getHeight() / 2.0, g2d, false, true);
		g2d.setColor(tmp);
	}
	return dvRR;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:32,代码来源:QueueDrawer.java


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