hi can you help me to modify this program to make it an isoceles or equilateral triangle? right now am having a right angle triangle!

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;


public class Triangle extends Frame {
	Line2D line1 = new Line2D.Double(50,150,150,150);
	  Line2D line2 = new Line2D.Double(50,50,150,150);
	  Line2D line3 = new Line2D.Double(50,50,50,150);

	  	//Stroke drawingStroke = new BasicStroke(2);
	  	public void paint(Graphics g) 
	  	{
		  Graphics2D graph = (Graphics2D)g;
		 //graph.setStroke(drawingStroke);
		  graph.setPaint(Color.blue);
		  graph.draw(line1);
		  graph.draw(line2);
		  graph.draw(line3);
	 

	  	}

	  	public static void main(String args[]) 
	  	{
		  Frame frame = new Triangle();
		  frame.addWindowListener(new WindowAdapter(){
			  public void windowClosing(WindowEvent we)
			  {
				  System.exit(0);
			  }
		  });
		  frame.setSize(1000, 1000);
		  frame.setVisible(true);
	  	}
	}

Just get some squared paper and draw the triangle you want on it, then look and see what the coordinates of the corners are, and feed those into lines 7.8.9 of your code.

If you can draw a right triangle then I think you'd be fine in doing the isosceles or equilateral triangle by just tinkering with the line position and their sizes until you get the desired looks

have been trying this for long but no luck!!! :(

ショートプログラムを投稿するには、それは簡単ですが、その実行は本当に無限大です

Please write in english

Its a feeble attempt at a joke for zeroliken - the snow over Europe has me stuck indoors with nothing better to do. Just ignore it. J

Its a feeble attempt at a joke for zeroliken - the snow over Europe has me stuck indoors with nothing better to do. Just ignore it. J

Let me guess,there's a certain translator that helped you ;)

@OP it's gonna be trial and error if you have no idea about the exact coordinates you need for the certain triangles

Damn! You saw right through my attempt to appear poly-lingual. I've been snowed in for a week, bored, bored, bored, and desperate for entertainment. Embarrassing or what?

Damn! You saw right through my attempt to appear poly-lingual. I've been snowed in for a week, bored, bored, bored, and desperate for entertainment. Embarrassing or what?

Can't you have a bit of fun in the snow?
or does saying that make me sound childish :D

besides that I woudn't recommend doing another non english post,last year 1 replied to me in the same way and an admin deleted his post and downvoted him saying english only

@OP don't mind us just continue with trying to get the correct values for the shapes you'll get it eventually

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.