Making a graph in java

Hi
I want to take data from a mySQL database and show it in an applet as a graph.
The problem I'm having is creating the graph.
Does anyone know a fairly simple way to do this?
thanks

this can get you started:
go and google for "applet drawing java source code"
then when you figure out how they draw in the applet, you can draw some lines and points

Similar Messages

  • Creating control flow graph in java using list

    i am making control flow graph in java by making use of stacks and list but i am unable to get to previous nodes of the current node.
    how to code for the same and make a graph that is randomly generated.

    Don't double post. I've removed the thread you started in the Java Desktop Application forum 4 minutes after this one, with the identically same question.
    db

  • How do I generate a graph in Java?

    I need to implement a graph in java or possibly create a graph in excel through java (if possible). any help would be greatly appreciated as i need to do this within about a week!

    Download JFreeChart and give it a try:
    http://www.object-refinery.com/jfreechart/index.html
    JFreeChart is distributed for free, including the complete source code (subject to the GNU LGPL).
    Regards,
    Dave Gilbert
    JFreeChart Project Leader

  • Flexible graphs from java script

    Hi,
    Can anybody help me to find flexible graphs with java script?. I am using Oracle 9i as my database, jsp and ejbs...
    Thank you.

    Can anybody help me to find flexible graphs with java script?. "Flexible graphs"? If you mean a graphing package in Java, just google for it. Plenty of commercial, shareware and freeware choices available (though some are obviously a lot better than others :-).

  • Making a database in Java

    would making a database in Java be hard especially if I wanted to incorporate SQL into the data base?

    jverd wrote:
    Adrienk wrote:
    can I make a program that will interact with a database (lets say oracle)Google for jdbc tutorial.
    in such a way where i can use arrays to store information and then sort through the arrays at a latter time by use of a search method to find and pull specific information? or would i even need a data base for this type of project?That's very vague, and arrays really have nothing to do with it. You will define classes in Java, such as, say, Student, Course, Instructor, Classroom, etc. A given application or feature will use some or all of those classes. If an application needs to be able to do things like "print the class list for a given student," and "find the classrooms available for a particular course," and a dozen others, then, yes, you probably want a database to manage the relationships, searching, filtering, and all the stuff that a DB is made for. If, on the other hand, it's just a simple app that displays a few things, lets you select something, and maybe retrieves a few simple objects by fixed keys like name or ID, then a DB is probably overkill.the relationship is what i want to do, so now i wonder - how do you create an application in java to interact with a database?

  • Line graphs in java

    I am looking for a free class that will allow me to graph a line graph in java. I was going to write my own but figured there must already be some out there... There doesn't happen to be a JGraph object that sun is working is there?

    Look at JFreeChart, it contains tools to draw many different charts and graphs.
    DB

  • [Graphs in Java] Graphs library

    Hi there,
    my name is roberto...i want to know if exists a library to construct a graph in java....
    please answer me .. tks

    Sorry--I guess I misinterpreted "graphs".
    Tried googling (neural net java):
    First hit:
    http://rfhs8012.fh-regensburg.de/~saj39122/jfroehl/diplom/e-index.html
    Lots (418,000) of other hits, too. Probably one of them will suit your purposes.

  • Help||||||||how to draw graphs in java

    dear all
    i m new to the java technology.i am at present working on aproject in which i need to draw graphs.these graphs will show the graphs for past one month,past six month and past one year records display.can u suuggest me where to get the help and how to get the sample sorce code for that.thanx
    regards
    sheetal

    There are a couple of Open Source projects for graphing in Java on Sourceforge, try:
    http://sourceforge.net/projects/jopenchart/
    http://sourceforge.net/projects/jfreechart/
    I haven't used them myself, but I intend to look closer in the future...

  • How to draw a directed 2D graph in java

    how to draw a directed 2D graph in java?-if anybody can suggest some tutorials about this topic or can suggest the way to draw the graph.......how can i do that.......if the nodes of the graph has X and Y co-ordinate.........and the neighbours of each node are known.......suppose
    node1 has neighboures node2,node3 and node4.....node2 has node5 and node3 as neighbours.....in this way....so directed edge from node1 to node2,node3,and node4......
    or if u can suggest other way out......plz reply....

    prometheuzz wrote:
    JosAH wrote:
    If you can draw a line between two points (x,y) and (x',y') you can draw an edge.
    If you can draw one edge you can draw all edges of a graph.Proof by induction!
    ; )Yep, I copied/pasted exactly the same answer I gave this poster in another forum; I recognized him by his 'plz'-es and the abundance of punctuation ;-)
    kind regards,
    Jos

  • Need help making pace invaders in java

    So here is my code:
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.*;
    import javax.swing.JFrame;
    import java.awt.*;
    import javax.swing.JPanel;
    import java.awt.Canvas;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import java.net.URL;
    import javax.imageio.ImageIO;
    public class invaders extends Canvas {
    public static final int Width = 800;
    public static final int Height = 600;
    public invaders() {
    JFrame openspace = new JFrame("Space Invaders");
    JPanel window = (JPanel)openspace.getContentPane();
    setBounds(0,0,Width,Height);
    window.setPreferredSize(new Dimension(Width,Height));
    window.setLayout(null);
    window.add(this);
    openspace.setBounds(0,0,Width,Height);
    openspace.setVisible(true);
    openspace.addWindowListener( new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    public void paint(Graphics graph) {
    // graph.setColor(Color.red);
    // graph.fillOval( Width/2-10, Height/2-10,20,20);
    // spacealien = loadImage("spaceAlien.jpg");
    // graph.drawImage(spaceAlien, 50, 50, this);
    public static void main(String[] args) {
    invaders spaceinvaders = new invaders();
    I am trying to add pictures into the JFrame but I don't know how. I am following this tutorial http://www.planetalia.com/cursos/Java-Invaders/JAVA-INVADERS-04.tutorial but I get confused when they talk about how to add in an image.
    This is their Code:
    1 package version04;
    2 /**
    3 * Curso B?sico de desarrollo de Juegos en Java - Invaders
    4 *
    5 * (c) 2004 Planetalia S.L. - Todos los derechos reservados. Prohibida su reproducci?n
    6 *
    7 * http://www.planetalia.com
    8 *
    9 */
    10
    11
    12 import java.awt.Canvas;
    13 import java.awt.Dimension;
    14 import java.awt.Graphics;
    15 import java.awt.event.WindowAdapter;
    16 import java.awt.event.WindowEvent;
    17 import java.awt.image.BufferedImage;
    18 import java.net.URL;
    19
    20 import javax.imageio.ImageIO;
    21 import javax.swing.JFrame;
    22 import javax.swing.JPanel;
    23
    24 public class Invaders extends Canvas {
    25 public static final int WIDTH = 800;
    26 public static final int HEIGHT = 600;
    27
    28
    29 public Invaders() {
    30 JFrame ventana = new JFrame("Invaders");
    31 JPanel panel = (JPanel)ventana.getContentPane();
    32 setBounds(0,0,WIDTH,HEIGHT);
    33 panel.setPreferredSize(new Dimension(WIDTH,HEIGHT));
    34 panel.setLayout(null);
    35 panel.add(this);
    36 ventana.setBounds(0,0,WIDTH,HEIGHT);
    37 ventana.setVisible(true);
    38 ventana.addWindowListener( new WindowAdapter() {
    39 public void windowClosing(WindowEvent e) {
    40 System.exit(0);
    41 }
    42 });
    43 }
    44
    45 public BufferedImage loadImage(String nombre) {
    46 URL url=null;
    47 try {
    48 url = getClass().getClassLoader().getResource(nombre);
    49 return ImageIO.read(url);
    50 } catch (Exception e) {
    51 System.out.println("No se pudo cargar la imagen " + nombre +" de "+url);
    52 System.out.println("El error fue : "+e.getClass().getName()+" "+e.getMessage());
    53 System.exit(0);
    54 return null;
    55 }
    56 }
    57
    58
    59 public void paint(Graphics g) {
    60 BufferedImage bicho = loadImage("res/bicho.gif");
    61 g.drawImage(bicho, 40, 40,this);
    62 }
    63
    64 public static void main(String[] args) {
    65 Invaders inv = new Invaders();
    66 }
    67 }
    68
    I know there must be an easier way. Please help, thanks!!!!

    One way to add an image to a user interface is to use a JLabel with an ImageIcon: [http://java.sun.com/docs/books/tutorial/uiswing/components/label.html]

  • A graph in java?

    Hello,
    I have a file that represent a graph I suppose:
    nodeA    1111  2222
    nodeb    2222  4444
    nodec    3333  nodeA
    noded   nodec nodeaI need for each NodeX to print out all leafs
    eg:
    nodea 1111 2222
    Noded: 3333 1111 2222
    what do you suggest? is it better create a representation of the grapgh before? is there any famous solution?
    thanks,
    Edited by: mickey0 on May 19, 2009 3:39 AM

    I would suggest that you first create the graph like this:
    import java.util.*;
    class TreeMap{
       public static void main(String args[]){
    //Create your tree map
    TreeMap tm = new TreeMap();
    //Fill your map
    tm.put(new int(1111), new int(2222));
    tm.put(new int(2222), new int(4444));Then, you get an iterator to traverse through the map as you wish (append to the above code):
    //Get a set of the entries
    Set set = tm.entrySet();
    //Get an iterator
    Iterator i = set.iterator();
    //Proceed with what you want to do with the iterator whether to traverse the content of the map or display all its elements.I hope this makes it clear

  • Graphs in java swing

    hi,
    i am having some x and y values (or some function of x)and i would like to plot a graph between them.
    what is the best and simplest way to do it in java swing.
    thanx

    ...if you want to leave it simple, overwrite a custom JComponent's paintcomponent(Graphics) method and use the native drawing commands such as drawLine(...) and draw(Shape) (take a look at Graphics2D). If you are looking for a more sophisticated solution with professional graph packages i recommend JFreeChart (http://www.jfree.org). It is, however, a bit tricky to use, not suitable if you just begun working with java.

  • Making different graphs like bar chart in excel sheet

    Hello,
    In my application i have to make different graphs like bar chart,pie chart etc which is present in the excel sheet.In the same excel sheet i have to make the graphs based on the data through java program.
    I am unable to do it.Can anyone suggest me how to do.Is there any api and documents(for reading )for it?
    thanks in advance
    chimpuk

    Hi, you might want to do a search before you post. At the top of the page is a link to advanced search. Right-click on it and choose 'open in a new window'. Now, in the 'with all the words' box type the word excel, then hit the space bar, then type the word chart[b], now down lower clear all the checkboxes except [b]Java Forums, now hit the Search button and you get a list of threads related to excel and chart. Read a few. I think most of your questions will be answered.

  • Making optgroup /optgroup in Java

    Is it possible to implement this drop-down box in a Java Swing application? I kept searching for this from the web, but I cant find relevant info. I cant make the optgroup function in neither JComboBox nor JList. Tell me how to do it, if you have this experience.
    Thanks in advance!
    <select>
      <optgroup label="Swedish Cars">
        <option value="volvo">Volvo</option>
        <option value="saab">Saab</option>
      </optgroup>
      <optgroup label="German Cars">
        <option value="mercedes">Mercedes</option>
        <option value="audi">Audi</option>
      </optgroup>
    </select>

    Sorry for my inaccurate English.
    And thank you DarrylBurke for the correction, I have looked it in the dictionary.
    Back to my question, actually I have a particular question about making the list items of JComboBox not selectable, as in the first picture. The second picture is the Swing version, in which I'm not able to make it not selectable.
    [1. HTML combo box|http://home.netvigator.com/~bigblack/labu/drop-down-box.gif]
    [2. JComboBox|http://home.netvigator.com/~bigblack/labu/drop-down-box-swing.png]
    I always read the suggested tutorials, the closest parts are about implementing ActionListener and ListCelRenderer. Do I have a more-convenient alternative?

  • Making nice GUI in Java!!!???

    I've used Visual Basic where you add frames to an MDI parent for making a multiscreen project
    I want to do similar in Java. Is the only way to do this through using Desktoppane or splitpane? I dont like the visible split in splitpane, and I don't like the topbar on the jinternalframe. What can I do. Any good suggestions.

    Hello,
    you can try to use change the CommonLookAndFell.
    try {
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    catch(ClassNotFoundException e){}
    then the topbar should have another appearance.
    Andre

Maybe you are looking for

  • Help restore not working

    i bought a new ipod nano (2nd gen) and i put in some songs. then i deleted the songs on my itunes library and unplugged my ipod. then i imported more songs into the library but then a message pops up and says that i have a corrupt ipod and i need to

  • URGENT ISSUE - CVI - Customer /Business Parnter load incorrect

    We have loaded the Customer master in our Prod system and the CVI settings resulted in creation of Business Partners for the customers. However, the number range was different for BPs and Customer account group resulting in mis match of the Account n

  • Finder Unexpectedly quit error message when rebuilding desktop in 9

    When I try to rebuild the desktop, I am still getting the Finder Unexpectedly Quit error. This is happening with my iMac G3. I'm running OS 9.2.2 and 10.4.3. I followed all the directions in the Apple Help file here: http://support.apple.com/kb/HT234

  • Safari opens but crashes when loading any page

    I recently upgraded to Safari 6.0 (7536.25) on Lion 10.7.4. Now Safari opens but crashes as soon as I try to load a page. I've tried most of the fixes that I could find in the recent posts: different pages to be sure it isn't page specific disabled a

  • Cross tab - Rank column

    I am trying to create a column that represents the rank of a row based on a column.  So if I have schools like Harvard, Princeton, Yale and each school is on the left and they have values of tuition, cost of living.  I would like to display two diffe