Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-11-13
2
Medium Priority
?
269 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 36

Accepted Solution

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

Author Comment

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

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Simple Linear Regression
Suggested Courses

715 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