
java - How do I draw a triangle? - Stack Overflow
Apr 4, 2015 · You may use Graphics.drawPolygon(int[], int[], int) where the first int [] is the set of x values, the second int [] is the set of y values, and the int is the length of the array. (In a …
java - Making a triangle polygon in an applet - Stack Overflow
Mar 1, 2016 · The 3 times g2.draw is used makes me a nice right triangle, but I want it to be filled with a color. How should I go forth turning those points into a triangle polygon so it can be filled?
Draw Triangle in Java Applet - Webeduclick.com
Draw Triangle in Java Applet import java.applet.*; import java.awt.*; public class Triangle extends Applet { public void paint(Graphics g1) { g1.drawLine(180,150,180,370); …
Java Program to Create Different Shapes using Applet
Nov 15, 2023 · In this article, we will be creating different shapes using Applet. Here, we have taken an Input field, where the user can enter the name of the shape and click on the button. …
java - Triangle Draw Method - Stack Overflow
There is no direct method to draw a triangle. You can use drawPolygon() method for this.
Java Program to Create and Fill Shapes using Applet
1. Use method drawPolygon and fillPolygon of the Graphics class to draw and fill the shapes – Square, Pentagon, Rectangle and Triangle. 2. Use method drawOval and fillOval of the …
How do you draw a triangle in Java with an applet?
In this application there are examples of how to draw lines, squares and how to round its vertices, other geometric figures (circle, oval, slope to find triangles, pentagons …), how to give …
Draw Triangles Example - csis.pace.edu
Example that draws triangles on an applet. import java.awt.*; import java.applet.Applet; import java.awt.event.*; public class DrawTriangles extends Applet { private Graphics g; private …
How to Draw a Triangle in Java - Delft Stack
Feb 2, 2024 · Use java.awt, javax.swing and drawPolygon to Draw a Triangle in Java. We use JFrame to create a top-level container, and then add a panel, which is our DrawATriangle …
Draw Shapes In An Applet - Java Examples
import java.applet.*; import java.awt.*; public class ShapesApplet extends Applet { public void paint (Graphics g) { int xa [] = { 120, 125, 150, 150, 200, 200 }; int ya [] = { 175, 100, 100, 175, …
- Some results have been removed