File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes jcomboboxes linked to textarea displays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "jcomboboxes linked to textarea displays" Watch "jcomboboxes linked to textarea displays" New topic

jcomboboxes linked to textarea displays

Max Lipshitz

Joined: Mar 28, 2009
Posts: 3
Here's what I'm trying to do;

I have 4 jcombobox's that need to contain several letters each, when a letter is selected it will display the corresponding text in one of four jtextarea's

I am very new to this, I can generally modify existing code but have never really started from scratch, I got as far as creating the containers and controls but I am stumped as to how to get the comboboxes to work and data to display in the text areas

This code is what I have so far, I am using NetBeans IDE 6.5.1, a screenshot of the interface is included.


This is what it looks like in the IDE

I have it working as an excel spreadsheet, it looks like this;

updated code (3/29/09 9:45am)

Rob Spoor

Joined: Oct 27, 2005
Posts: 20275

Please Use Code Tags. You can use the Edit button to update your post.

How To Ask Questions How To Answer Questions
Max Lipshitz

Joined: Mar 28, 2009
Posts: 3
I'm a little further along, I have the correct selections in the combobox's now. I still need to display text in the ScrollPane / TextArea's that correspond to the selection in the corresponding combobox.

For example, looking at the excel screenshot, the letters in the yellow boxes correspond to the text that is in the 4 boxes below the letters, in the 1st yellow box is the letter "D". In the data fields below, the "D" corresponds to "Duct PIC" so "Duct PIC" is displayed in the chart next to "cable design". This is what I am trying to do.

I need to know where in the code to put the data that is to be looked up and displayed when a value is chosen in the drop down combobox and how to link the combobox to the Scrollpane/TextArea so that the text associated with the combobox choice is displayed in it.

I also updated the code above to reflect the choices in the comboboxes
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
here's a simple demo of what I think you're trying to do

generally, posting netbeans-generated code is a waste of time.
few, if any, will read it, and unless using netbeans, it cant' be copied into other ide's and run 'as-is'

if you have a problem with a component, don't post all your code, create another program and strip
it down to the problem component, similar to above code i.e. just enough code that can be compiled
and the problem seen.
Max Lipshitz

Joined: Mar 28, 2009
Posts: 3
Michael, yes, that is very similar to what I am looking for, applying this to the code I already have, can you point out which section looks for the letter chosen in the dropdown box and which section outputs the text to the text box? Thanks
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
this is the method that handles both, and the message says it all

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

"Max Tech", please check your private messages for an important administrative matter.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: jcomboboxes linked to textarea displays
It's not a secret anymore!