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: How to show 2D array using combobox and radiobutton?

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

    Default How to show 2D array using combobox and radiobutton?

    I am a little confused on Array's and wonder if someone could help me?

    I have a two dimensional Array with 4 rows and 2 columns
    int display[][]= new int[4][2];

    Im a little confused about how to do the math and also use for statements with it. I have a survey that I am doing using two different options a ComboBox(foodJComboBox) and a Radiobutton(likeJRadioButton). The foodJComboBox choices comes from an array(one dimensional) that feeds the combo box.

    I am trying to make the array have two columns one for like one for dislike and to display the numbers in there. array is display

    Using both of those options for writing a for statement I am not able to figure it out. Any help would be greatly appreciated. Here is what I have come up with and am obviously at a loss.

    int display[][]= new int[4][2];
    for(likeJRadioButton=true; foodChoices = "Pizza"; pizzaLike++)
    {
     pizzaLike = display[0][0]+1
    }
    for(dislikeJRadioButton = false; foodChoices = "Pizza"; pizzaDislike++)
    {
    pizzaDislike = display[0][1]+1
    }

    Can you please instruct me where I am going wrong?


  2. #2

    Default Re: Two Dimensional For question

    Sorry but I need more information in order to help you. Can you write more of your code?

Similar Threads

  1. Getting an error while altering a source code
    By marksquall in forum Collections and Generics
    Replies: 3
    Last Post: June 8th, 2009, 03:49 AM
  2. [SOLVED] How to narrow down the range of input in java?
    By big_c in forum What's Wrong With My Code?
    Replies: 5
    Last Post: April 20th, 2009, 12:38 PM

Tags for this Thread