Results 1 to 3 of 3

Thread: GUI Help!!

  1. #1
    larry_d1990 is offline Member
    Join Date
    Jan 2011
    Posts
    11
    Rep Power
    0

    Default GUI Help!!

    Hi

    I'm trying to create a Line Graph, I've tried using a JPanel within a JFrame and the basic graph is ok, however I cannot display information at the side of the graph, such as x and y axis, as well as numbers 0, 1, 2 etc...

    How can this be solved??

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    The simplest way to use this is to use a Java library built for creating these types of graphs such as JFreeChart (I think is the name). If this option isn't viable, for instance if this is for a school project and you will have to write the code yourself, then you're going to have to do just that: write code that displays such text on the sides of the Graph often using the methods that are available to you in the Graphics and Graphics2D libraries.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,000
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by larry_d1990 View Post
    Hi

    I'm trying to create a Line Graph, I've tried using a JPanel within a JFrame and the basic graph is ok, however I cannot display information at the side of the graph, such as x and y axis, as well as numbers 0, 1, 2 etc...

    How can this be solved??
    A Graphics object can draw entire Strings (see the API documentation for that class). You can draw the appropriate Strings at the appropriate location.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •