Criando formas básicas em Java
Aprenda nesta dica a fazer desenhos simples em Java.
Criando formas básicas em Java
Esta dica de Java demonstra um método de desenhar formas básicas em um componente Java. As formas básicas podem ser desenhadas por um desenvolver que modifica a função paint() do componente.
Este exemplo desenha uma linha, um arco, um símbolo oval, um retângulo e um retângulo com cantos arredondados em seu componente.
Shape line = new Line2D.Float(x1, y1, x2, y2);<SPAN lang=EN-US >Shape arc = </SPAN><B><SPAN lang=EN-US >new </SPAN></B><SPAN lang=EN-US >Arc2D.Float(x, y, w, h, start, extent, type); </SPAN><SPAN lang=EN-US >Shape oval = </SPAN><B><SPAN lang=EN-US >new </SPAN></B><SPAN lang=EN-US >Ellipse2D.Float(x, y, w, h); </SPAN><SPAN lang=EN-US >Shape rectangle = </SPAN><B><SPAN lang=EN-US >new </SPAN></B><SPAN lang=EN-US >Rectangle2D.Float(x, y, w, h);</SPAN><SPAN lang=EN-US >Shape roundRectangle = </SPAN><B><SPAN lang=EN-US >new </SPAN></B><SPAN lang=EN-US >RoundRectangle2D.Float(</SPAN><SPAN lang=EN-US >x, y, w, h, arcWidth, arcHeight);</SPAN>
Artigos relacionados
-
Artigo
-
Artigo
-
Artigo
-
Artigo
-
Artigo