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


Java Ellipse2D类代码示例

本文整理汇总了Java中java.awt.geom.Ellipse2D的典型用法代码示例。如果您正苦于以下问题:Java Ellipse2D类的具体用法?Java Ellipse2D怎么用?Java Ellipse2D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CompassPlot

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
/**
 * Constructs a new compass plot.
 *
 * @param dataset  the dataset for the plot.
 */
public CompassPlot(ValueDataset dataset) {

    super();

    if (dataset != null) {
        this.datasets[0] = dataset;
        dataset.addChangeListener(this);
    }


    this.circle1 = new Ellipse2D.Double();
    this.circle2 = new Ellipse2D.Double();
    this.rect1   = new Rectangle2D.Double();
    setSeriesNeedle(0);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:CompassPlot.java

示例2: main

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
  Graphics2D g = image.createGraphics();

  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g.setPaint(Color.WHITE);
  g.fill(new Rectangle(image.getWidth(), image.getHeight()));
  g.scale(.9, .9);
  g.setPaint(Color.BLACK);
  g.setStroke(new BasicStroke(0.5f));
  g.draw(new Ellipse2D.Double(25, 25, 150, 150));

  // To visually check it
  //ImageIO.write(image, "PNG", new File(args[0]));

  boolean nonWhitePixelFound = false;
  for (int x = 100; x < 200; ++x) {
    if (image.getRGB(x, 90) != Color.WHITE.getRGB()) {
      nonWhitePixelFound = true;
      break;
    }
  }
  if (!nonWhitePixelFound) {
    throw new RuntimeException("A circle is rendered like a 'C' shape.");
  }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:ScaleTest.java

示例3: runTest

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
public void runTest(Object ctx, int numReps) {
    FillEllipse2Ds.Context cctx = (FillEllipse2Ds.Context) ctx;
    int size = cctx.size;
    int x = cctx.initX;
    int y = cctx.initY;
    Ellipse2D ellipse = cctx.ellipse;
    Graphics2D g2d = (Graphics2D) cctx.graphics;
    g2d.translate(cctx.orgX, cctx.orgY);
    Color rCArray[] = cctx.colorlist;
    int ci = cctx.colorindex;
    do {
        if (rCArray != null) {
            g2d.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
        }
        ellipse.setFrame(x, y, size, size);
        g2d.fill(ellipse);
        if ((x -= 3) < 0) x += cctx.maxX;
        if ((y -= 1) < 0) y += cctx.maxY;
    } while (--numReps > 0);
    cctx.colorindex = ci;
    g2d.translate(-cctx.orgX, -cctx.orgY);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:RenderTests.java

示例4: setShape

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
/**
 * Creates the shape of the vertex given its description in a string
 * @param shapeString "square" or "circle"
 */
public void setShape(String shapeString) {
	Shape newShape;
	if (shapeString.startsWith("square")){
		Rectangle2D rectangle = new Rectangle2D.Float();
		rectangle.setFrameFromCenter(0,0,size,size);
		newShape = rectangle;
	}
	else
	{
		Ellipse2D ellipse = new Ellipse2D.Float();
		ellipse.setFrameFromCenter(0,0,size,size);
		newShape = ellipse; 
	}
	this.shape = newShape;
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:20,代码来源:Vertex.java

示例5: changeDrawSettings

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
public void changeDrawSettings(DrawConstrains dCst) {
	this.dCst = dCst;
	resize();
	// assigning the constant of panel
	f = dCst.getFont();
	stroke = dCst.getDrawStroke();
	START_GAP = dCst.getStartingGap();
	END_GAP = dCst.getStartingGap();
	ELEM_HEIGHT = dCst.getElementHeight();
	ELEM_WIDTH = dCst.getElementWidth();
	ELEMS_GAP = dCst.getElementsGap();
	PROC_RAD = dCst.getProcessorRadius();

	// initilazing the queue
	queue = new Rectangle2D.Double[queueLength()];
	processor = new Ellipse2D.Double();
	// repaint();
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:19,代码来源:QueueDrawer.java

示例6: drawStatus

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
public void drawStatus(int status, double probability, Graphics2D g2d, Color sc, Color pc, Color borderC, boolean bold) {
	double x = 2.0 * (2.0 * STATUS_RAD + ELEMS_GAP) * status + START_GAP;
	double y = panelH / 2.0 - STATUS_RAD;
	double pie = probability * 360;
	Color ctmp = g2d.getColor();
	if (bold) {
		g2d.setStroke(strokeB);
	}
	statusE[status] = new Ellipse2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0);
	statusP[status] = new Arc2D.Double(x, y, STATUS_RAD * 2.0, STATUS_RAD * 2.0, 0.0, pie, Arc2D.PIE);
	g2d.setPaint(sc);
	g2d.fill(statusE[status]);
	g2d.setPaint(pc);
	g2d.fill(statusP[status]);
	g2d.setPaint(borderC);
	g2d.draw(statusE[status]);
	drawCenteredText(probabilityToString(probability, 3), Color.BLACK, x + STATUS_RAD, y - STATUS_RAD, g2d, false);
	drawCenteredText("" + status, borderC, x + STATUS_RAD, panelH / 2.0, g2d, false);
	g2d.setColor(ctmp);
	g2d.setStroke(stroke);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:22,代码来源:StatiDrawer.java

示例7: draw

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
/**
 * Draws the background to the specified graphics device.  If the dial
 * frame specifies a window, the clipping region will already have been 
 * set to this window before this method is called.
 *
 * @param g2  the graphics device (<code>null</code> not permitted).
 * @param plot  the plot (ignored here).
 * @param frame  the dial frame (ignored here).
 * @param view  the view rectangle (<code>null</code> not permitted). 
 */
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, 
        Rectangle2D view) {

    g2.setPaint(this.fillPaint);
    
    Rectangle2D f = DialPlot.rectangleByRadius(frame, this.radius, 
            this.radius);
    Ellipse2D e = new Ellipse2D.Double(f.getX(), f.getY(), f.getWidth(), 
            f.getHeight());
    g2.fill(e);
    g2.setPaint(this.outlinePaint);
    g2.setStroke(this.outlineStroke);
    g2.draw(e);
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:DialCap.java

示例8: draw

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
/**
 * Draws the frame.  This method is called by the {@link DialPlot} class,
 * you shouldn't need to call it directly.
 *
 * @param g2  the graphics target (<code>null</code> not permitted).
 * @param plot  the plot (<code>null</code> not permitted).
 * @param frame  the frame (<code>null</code> not permitted).
 * @param view  the view (<code>null</code> not permitted).
 */
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, 
        Rectangle2D view) {
    
    Shape window = getWindow(frame);
    
    Rectangle2D f = DialPlot.rectangleByRadius(frame, this.radius + 0.02, 
            this.radius + 0.02);
    Ellipse2D e = new Ellipse2D.Double(f.getX(), f.getY(), f.getWidth(), 
            f.getHeight());
    
    Area area = new Area(e);
    Area area2 = new Area(window);
    area.subtract(area2);
    g2.setPaint(this.backgroundPaint);
    g2.fill(area);
    
    g2.setStroke(this.stroke);
    g2.setPaint(this.foregroundPaint);
    g2.draw(window);
    g2.draw(e);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:SimpleDialFrame.java

示例9: draw

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
@Override
public void draw(Graphics2D graphics) {
       float radius = emp.getRadius();
       float diameter = radius * 2;

       // inner ring
       graphics.setColor(outerColor);
       graphics.fill(new Ellipse2D.Double(drawLocation.getX() - radius,
               drawLocation.getY() - radius, diameter, diameter));

       radius = radius - 2;
       diameter = radius * 2;

       graphics.setColor(EMP_INNER_COLOR);
       graphics.fill(new Ellipse2D.Double(drawLocation.getX() - radius,
               drawLocation.getY() - radius, diameter, diameter));
       
}
 
开发者ID:amymcgovern,项目名称:spacesettlers,代码行数:19,代码来源:EMPGraphics.java

示例10: GenerateRTMapPNG

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
private void GenerateRTMapPNG(XYSeriesCollection xySeriesCollection, XYSeries series, float R2) throws IOException {
    new File(Workfolder + "/RT_Mapping/").mkdir();
    String pngfile = Workfolder + "/RT_Mapping/" + FilenameUtils.getBaseName(LCMSA.mzXMLFileName).substring(0, Math.min(120, FilenameUtils.getBaseName(LCMSA.mzXMLFileName).length() - 1)) + "_" + FilenameUtils.getBaseName(LCMSB.mzXMLFileName).substring(0, Math.min(120, FilenameUtils.getBaseName(LCMSB.mzXMLFileName).length() - 1)) + "_RT.png";

    XYSeries smoothline = new XYSeries("RT fitting curve");
    for (XYZData data : regression.PredictYList) {
        smoothline.add(data.getX(), data.getY());
    }
    xySeriesCollection.addSeries(smoothline);
    xySeriesCollection.addSeries(series);
    JFreeChart chart = ChartFactory.createScatterPlot("Retention time mapping: R2=" + R2, "RT:" + FilenameUtils.getBaseName(LCMSA.mzXMLFileName), "RT:" + FilenameUtils.getBaseName(LCMSB.mzXMLFileName), xySeriesCollection,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyPlot = (XYPlot) chart.getPlot();
    xyPlot.setDomainCrosshairVisible(true);
    xyPlot.setRangeCrosshairVisible(true);

    XYItemRenderer renderer = xyPlot.getRenderer();
    renderer.setSeriesPaint(1, Color.blue);
    renderer.setSeriesPaint(0, Color.BLACK);
    renderer.setSeriesShape(1, new Ellipse2D.Double(0, 0, 3, 3));
    renderer.setSeriesStroke(1, new BasicStroke(3.0f));
    renderer.setSeriesStroke(0, new BasicStroke(3.0f));
    xyPlot.setBackgroundPaint(Color.white);
    ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600);
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:26,代码来源:RTAlignedPepIonMapping.java

示例11: draw

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
public void draw(Graphics2D g) {
      float radius = Beacon.BEACON_RADIUS;
      float diameter = Beacon.BEACON_RADIUS * 2;
      
      Ellipse2D.Double shape = new Ellipse2D.Double(drawLocation.getX() - radius,
      		drawLocation.getY() - radius, diameter, diameter);

      g.setColor(BEACON_COLOR);
      g.fill(shape);

      g.setStroke(JSpaceSettlersComponent.THICK_STROKE);
      g.setColor(BEACON_LINE_COLOR);
      g.draw(shape);

      // add an E to make it clear it is an energy beacon
g.setPaint(Color.BLACK);
g.drawString("E", (int) drawLocation.getX()-3, (int) drawLocation.getY() + 4);

  }
 
开发者ID:amymcgovern,项目名称:spacesettlers,代码行数:20,代码来源:BeaconGraphics.java

示例12: paintPlace

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
/**
 * Paints the Place
 * @param g - graphic object to contain the Place
 */
public void paintPlace(Graphics g){
    int diameter = 30;

    Graphics2D g2d = (Graphics2D) g;
    g2d.setColor(Color.WHITE);
    Ellipse2D.Double circle = new Ellipse2D.Double((position.x - (diameter / 2)), (position.y - (diameter / 2)),
            diameter, diameter);
    g2d.fill(circle);

    g2d.setColor(Color.GREEN);
    g2d.fill(circle);
    if (token){
        g2d.setColor(Color.DARK_GRAY);
        Ellipse2D.Double t = new Ellipse2D.Double((position.x - (diameter / 4)),
                (position.y - (diameter / 4)),
                (diameter / 2), (diameter / 2));
        g2d.fill(t);
    }
}
 
开发者ID:tslaats,项目名称:SE2017-Team1,代码行数:24,代码来源:Place.java

示例13: addEntity

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
/**
 * Adds an entity to the collection.
 * 
 * @param entities  the entity collection being populated.
 * @param area  the entity area (if <code>null</code> a default will be used).
 * @param entityX  the entity's center x-coordinate in user space.
 * @param entityY  the entity's center y-coordinate in user space.
 * @param dataset  the dataset.
 * @param series  the series.
 * @param item  the item.
 */
protected void addEntity(EntityCollection entities, Shape area, 
                         XYDataset dataset, int series, int item,
                         double entityX, double entityY) {
    
    if (area == null) {
        area = new Ellipse2D.Double(
            entityX - this.defaultEntityRadius, entityY - this.defaultEntityRadius, 
            this.defaultEntityRadius * 2, this.defaultEntityRadius * 2
        );
    }
    String tip = null;
    XYToolTipGenerator generator = getToolTipGenerator(series, item);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, series, item);
    }
    String url = null;
    if (getURLGenerator() != null) {
        url = getURLGenerator().generateURL(dataset, series, item);
    }
    XYItemEntity entity = new XYItemEntity(area, dataset, series, item, tip, url);
    entities.addEntity(entity);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:AbstractXYItemRenderer.java

示例14: paintPlace

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
public void paintPlace(Graphics g){
    int diameter = 30;

    Graphics2D g2d = (Graphics2D) g;
    g2d.setColor(Color.WHITE);
    Ellipse2D.Double circle = new Ellipse2D.Double((position.x - (diameter / 2)), (position.y - (diameter / 2)),
            diameter, diameter);
    g2d.fill(circle);

    g2d.setColor(Color.GREEN);
    g2d.fill(circle);
    if (token){
        g2d.setColor(Color.DARK_GRAY);
        Ellipse2D.Double t = new Ellipse2D.Double((position.x - (diameter / 4)),
                (position.y - (diameter / 4)),
                (diameter / 2), (diameter / 2));
        g2d.fill(t);
    }
}
 
开发者ID:tslaats,项目名称:SE2017-Team1,代码行数:20,代码来源:PetriPlace.java

示例15: changeDrawSettings

import java.awt.geom.Ellipse2D; //导入依赖的package包/类
public void changeDrawSettings(DrawConstrains dCst) {
	this.dCst = dCst;
	resize();
	// assigning the constant of panel
	f = dCst.getFont();
	stroke = dCst.getDrawStroke();
	START_GAP = dCst.getStartingGap();
	END_GAP = dCst.getStartingGap();
	ELEM_HEIGHT = dCst.getElementHeight();
	ELEM_WIDTH = dCst.getElementWidth();
	ELEMS_GAP = dCst.getElementsGap();
	PROC_RAD = dCst.getProcessorRadius();

	// initilazing the queue
	queue = new Rectangle2D.Double[queueLenght()];
	processor = new Ellipse2D.Double();
	// repaint();
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:19,代码来源:QueueDrawer.java


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