Help with a program that asks a user for points and draws a line from said points
Hi, so my teacher makes everything 100x more complicated than it should and this lab is making me so frustrated it isn't even funny. I'm sure that there is a easy solution that I am completely missing lol.
This is what he wants: He wants us to prompt the user to input x values and y values (that will be entered into an array when clicking one of the two buttons (this one will say: Add point)). When they click the second button (draw lines), it should take all the points and draw a line that connects all the points together using a method that we write. In the method we have to call the paint method up which the lines will be drawn. The lines drawn should be touching every point added. It shouldn't have parameters. It will also use Graphics painter = getGraphics(); We can't use frames either.
I have everything up until the method understood.
I guess what I really need help is an explanation on how to write a method that will draw a line from points inputted that is called up in the action listener when the second button (draw lines) is pressed.
Sorry for such a beginner question :P
Any help will be appreciated, thank you!
Re: Help with a program that asks a user for points and draws a line from said points
If you know so much better than your teacher, what should be taught and how - why spending your time in school/college/university at all?
Hi, so my teacher makes everything 100x more complicated than it should
Your questions hints that you either missed some of lectures at your class or did not open the book which you should. The whole stuff is extremely simple and you can read all answers in any tutorial (which could be found from google in a few seconds). For example try this:
Trail: 2D Graphics (The Java™ Tutorials)
If you prefer something other - try something other. Keep in mind that the whole problem is for complete noobs so that you will succeed if only you spent necessary amount (not very big) of your time and efforts.
Of course you should know basics of java as prerequisites. If you don't, then google for tutorial on java basics also.