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 3 of 3

Thread: Java Program that plots point on a graph..need some help.

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Program that plots point on a graph..need some help.

    Hey fellas I need some help writing a program that plots two points on a graph in point intercept form in (x,y). I have recently programmed a times table program. i just don't understand how to graph points.
    thanks for your help!


  2. #2
    Member snowguy13's Avatar
    Join Date
    Nov 2011
    Location
    In Hyrule enjoying a chat with Demise and Ganondorf
    Posts
    339
    My Mood
    Happy
    Thanks
    31
    Thanked 48 Times in 42 Posts

    Default Re: Java Program that plots point on a graph..need some help.

    What you could do is draw points on a JPanel or other JComponent by editing that component's paintComponent() method. In this case, you would simply use the x, y coordinates and that would translate onto the panel (ie, the point (50, 100) would be used to draw a dot 50 px from the top of the panel and 100 from the left). Note that using this method, y grows larger as you move DOWN the panel (so you'd have to invert the y coordinate).

    Sorry I can't be more clear... Gotta go to a band concert!
    Use highlight tags to help others help you!

    [highlight=Java]Your prettily formatted code goes here[/highlight]

    Using these tags makes your code formatted, and helps everyone answer your questions more easily!




    Wanna hear something funny?

    Me too.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java Program that plots point on a graph..need some help.

    how to graph points.
    In the paintComponents() method you can use the Graphics class's drawOval method to draw a point.
    Look at the other methods of the Graphics class to see if there are other's that might help you.

Similar Threads

  1. Replies: 2
    Last Post: November 30th, 2011, 07:35 PM
  2. Replies: 3
    Last Post: September 8th, 2011, 02:25 PM
  3. Java Bar graph takes user input to create graph?
    By kenjiro310 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 31st, 2011, 07:37 AM
  4. My program doesnt want to do its math point my errors out please
    By Redlight in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 31st, 2010, 01:56 PM
  5. Replies: 1
    Last Post: October 7th, 2008, 07:35 AM