Solved

How to get the selection from a drop down list in Java?

Posted on 2013-11-13
2
253 Views
Last Modified: 2013-11-14
Hi,
I am working on creating a GUI in Java. In this GUI, I have a drop down list. I would like to get the selection from this list into a string.

This is the code snippet that I have in order to create this drop down list:


        
final Combo combo_workspaces = new Combo(shell, SWT.READ_ONLY);
.............
.........
//SOME MORE CODE IN HERE TO PREPARE THE CONTENT OF THIS COMBO.
.......
..............
combo_workspaces.setItems(workspacesArray.toArray(new String[workspacesArray.size()]));
        GridData data_comboWorkspaces = new GridData(GridData.FILL_HORIZONTAL);
        combo_workspaces.setLayoutData(data_comboWorkspaces); 

Open in new window




Can you please help me to get this selected value from the drop down list?
0
Comment
Question by:Tolgar
2 Comments
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39647076
combo_workspaces.getText() ?
0
 

Author Comment

by:Tolgar
ID: 39647093
That should work, right! I will try.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now