本文整理匯總了Java中java.awt.geom.Ellipse2D.Float方法的典型用法代碼示例。如果您正苦於以下問題:Java Ellipse2D.Float方法的具體用法?Java Ellipse2D.Float怎麽用?Java Ellipse2D.Float使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.geom.Ellipse2D
的用法示例。
在下文中一共展示了Ellipse2D.Float方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: paintBorder
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHints(ProcessDrawer.HI_QUALITY_HINTS);
g2d.setStroke(new BasicStroke(2f));
// clear edges, otherwise they will be in the color of the component background
if (drawRoundFrame && !c.getBackground().equals(c.getParent().getBackground())) {
Shape frame = new Rectangle2D.Float(x + 2, y + 2, width - 4, height - 4);
g2d.setPaint(c.getParent().getBackground());
g2d.draw(frame);
}
g2d.setPaint(paint);
g2d.setFont(new Font("Dialog", Font.BOLD, 21));
if (drawRoundFrame) {
Shape roundFrame = new RoundRectangle2D.Float(x + 2, y + 2, width - 4, height - 4, 10, 10);
g2d.draw(roundFrame);
}
if (number > 0) {
Shape circle = new Ellipse2D.Float(20, 20, 34, 34);
g2d.fill(circle);
g2d.setPaint(Color.WHITE);
g2d.drawString(String.valueOf(number), 29, 44);
}
if (key != null) {
g2d.setPaint(paint);
g2d.drawString(key, 60, 44);
}
g2d.dispose();
}
示例3: contains
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
@Override
public boolean contains(int x, int y) {
// TODO Auto-generated method stub
if(shape == null || shape.getBounds().equals(getBounds()))
shape = new Ellipse2D.Float(0,0,getWidth(),getHeight());
return super.contains(x, y);
}
示例4: contains
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
@Override
public boolean contains(int x, int y) {
// TODO Auto-generated method stub
if(shape == null || shape.getBounds().equals(getBounds()))
shape = new Ellipse2D.Float(0,0,getWidth(),getHeight());
return super.contains(x, y);
}
示例5: drawCircleImpl
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
/**
* The implementation of {@link #drawCircle(Vec, Vec, RGBAColor)}.
*
* @param pos
* same as in base method
* @param size
* same as in base method
* @param col
* same as in base method
*/
private void drawCircleImpl(Vec pos, Vec size, Color col) {
this.graphics.setColor(col);
Ellipse2D.Float circle = new Ellipse2D.Float(//
(pos.x - size.x / 2f), //
(pos.y - size.y / 2f), //
size.x, size.y);
this.graphics.fill(circle);
}
示例6: createShape
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
/**
*
*/
public Shape createShape(mxGraphics2DCanvas canvas, mxCellState state)
{
Rectangle temp = state.getRectangle();
return new Ellipse2D.Float(temp.x, temp.y, temp.width, temp.height);
}
示例7: getRegiaoCirculo
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
@Override
public Shape getRegiaoCirculo() {
if (Regiao == null) {
Regiao = new Ellipse2D.Float(getLeft(), getTop(), getWidth(), getHeight());
}
return Regiao;
}
示例8: DoPaintDoks
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
@Override
protected void DoPaintDoks(Graphics2D g) {
super.DoPaintDoks(g);
Stroke bkp = g.getStroke();
g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{1, 2}, 0));
Shape t = new Ellipse2D.Float(getLeft(), getTop(), getWidth(), getHeight());
g.draw(t);
g.setStroke(bkp);
}
示例9: getRegiao
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
@Override
public Shape getRegiao() {
if (Regiao == null) {
Regiao = new Ellipse2D.Float(getLeft(), getTop(), getWidth(), getHeight());
}
return Regiao;
}
示例10: DoPaint
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
@Override
public void DoPaint(Graphics2D g) {
if (isAutosize()) {
int largura = g.getFontMetrics(getFont()).stringWidth(getTextoToDraw()) + getHeight() + 4 + 4;
if (getWidth() != largura) {
setStopRaize(true);
setWidth(largura);
setStopRaize(false);
needRecalPts = true;
calculePontos();
SendNotificacao(Constantes.Operacao.opResize);
setRegiao(null);
if (isSelecionado()) {
Reposicione();
}
ReSizedByAutoSize();
}
}
super.DoPaint(g);
Shape reg;
if (getDirecaoLigacao() == Direcao.Left) {
reg = new Ellipse2D.Float(getLeft(), getTop(), getHeight() - 1, getHeight() - 1);
} else {
reg = new Ellipse2D.Float(getLeft() + getWidth() - getHeight(), getTop(), getHeight() - 1, getHeight() - 1);
}
Stroke bkps = g.getStroke();
if (isOpcional()) {
g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{4, 2}, 0));
}
if (isIdentificador()) {
g.fill(reg);
} else {
g.draw(reg);
}
if (isOpcional()) {
g.setStroke(bkps);
}
}
示例11: Vertex
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
/**
* General constructor for a vertex
* @param id
*/
public Vertex(int id){
this.id = generateID(id);
Ellipse2D ellipse = new Ellipse2D.Float();
ellipse.setFrameFromCenter(0,0,size,size);
shape = ellipse;
position = null;
}
示例12: createCircle
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
public static Shape createCircle() {
final float s = SHAPE_SIZE;
float s_d2 = Math.round(s / 2.0);
float s_dm2 = s_d2 * 2;
return new Ellipse2D.Float(-s_d2, -s_d2, s_dm2, s_dm2);
}
示例13: getShape
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
@Override
public Shape getShape() {
Ellipse2D p = new Ellipse2D.Float(-40, -20, 80, 40);
return p;
}
示例14: createShape
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
/**
*
*/
public Shape createShape(mxGraphics2DCanvas canvas, mxCellState state) {
Rectangle temp = state.getRectangle();
return new Ellipse2D.Float(temp.x, temp.y, temp.width, temp.height);
}
示例15: getRegiaoCirculo
import java.awt.geom.Ellipse2D; //導入方法依賴的package包/類
public Shape getRegiaoCirculo() {
if (Regiao == null) {
Regiao = new Ellipse2D.Float(getLeft(), getTop(), getWidth(), getHeight());
}
return Regiao;
}