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.

1 Visitor Messages

  1. I am trying create a Java program which draws a bar graph based on the input from the command line.
    Problem i am running into is that I cannot get the values of the Args[] starrting at index 2 to provide values unless i specify the numbers. ANy thoughts or ideas will help.
    Requirements



    public static void main(String[] args) {
    for (int i = 0; i < args.length; i++){
    //Grabs the first 2 elements of the users input
    int width = Integer.parseInt(args[0]);
    int height = Integer.parseInt(args[1]);

    //Controls the Height and Width of the frame
    JFrame frame = new JFrame();
    frame.setSize(height, width);

    double[] value = new double[10];
    //String[] labels = new String[10];
    value[0] = 80;
    //labels[0] = "1";

    value[1] = 40;
    //labels[1] = "2";

    value[2] = 30;
    //labels[2] = "2";

    value[3] = 60;
    // labels[3] = "3";

    value[4] = 45;
    //labels[4] = "4";

    value[5] = 96;
    //labels[5] = "5";

    value[6] = 74;
    //labels[6] = "6";

    value[7] = 100;
    //labels[7] = "7";

    value[8] = 240;
    //labels[8] = "8";

    value[9] = 60;
    //labels[9] = "9";

    frame.getContentPane().add(new GraphBarChart1(value, "ProjectOne"));

    WindowListener winListener = new WindowAdapter() {
    public void windowClosing(WindowEvent event) {
    System.exit(0);
    }
    };

    frame.addWindowListener(winListener);
    frame.setVisible(true);

    }
    }
    }
Showing Visitor Messages 1 to 1 of 1
About kenjiro310

Basic Information

Statistics


Total Posts
Total Posts
1
Posts Per Day
0.00
Visitor Messages
Total Messages
1
Most Recent Message
March 31st, 2011 07:05 AM
Total Thanks
Total Thanks
0
  • Thanked 0 Times in 0 Posts
General Information
Last Activity
March 31st, 2011 07:05 AM
Join Date
March 30th, 2011