Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Help with a program that asks a user for points and draws a line from said points

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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

    Any help will be appreciated, thank you!


  2. #2
    Member
    Join Date
    Oct 2013
    Location
    Saint-Petersburg, Russia
    Posts
    33
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default Re: 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
    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?

    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.

Similar Threads

  1. Calculating the line length between two points using oop
    By shanshayan111 in forum Object Oriented Programming
    Replies: 1
    Last Post: March 13th, 2013, 08:10 AM
  2. Get points along a line in Java Swing
    By libinthomas in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 16th, 2012, 07:42 AM
  3. Distance between 2 points
    By captain in forum Java Theory & Questions
    Replies: 3
    Last Post: February 22nd, 2012, 12:53 AM
  4. I like plotting points :) HI!
    By fractalorbit in forum Member Introductions
    Replies: 1
    Last Post: September 5th, 2011, 10:49 AM
  5. Getting all points in line
    By Mike in forum Java Theory & Questions
    Replies: 7
    Last Post: September 13th, 2010, 11:59 AM

Tags for this Thread