This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes 2D Array Help Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "2D Array Help" Watch "2D Array Help" New topic
Author

2D Array Help

Joe Namdt
Greenhorn

Joined: May 20, 2008
Posts: 1
How do I select a column in the array? I can select the row just fine but for my ComboBox I need to select the column as the values for the combobox.

Thanks in advance.




[ May 27, 2008: Message edited by: Joe Namdt ]
[ May 27, 2008: Message edited by: Joe Namdt ]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32675
    
    4
I am very sorry, but I moved your original post to another forum because it appeared to be more appropriate there.

The original seems to have vanished mysteriously, and I am sure I didn't send it to the wrong place. I am afraid I still think this is more of a specific Swing topic than a general beginner's topic, so I shall transfer this thread to Swing as well.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216


Like you already know, getting rows is quite easy. There is no way to get a column directly though - partNumberString is not a matrix but an array, with each element being an array of Strings.

To get the second column (numbered 1), you need to create a new array:

You will need to make 100% sure that all arrays in partNumberString have the same length, or this code may fail. Fortunately, in your code that's ok.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: 2D Array Help
 
Similar Threads
ActionListener problems
Please rescue me out
NX: URLy Bird 1.3.1 Suncertify.properties
How to use CardLayout Manager
Setting color in a JComboBox