Results 1 to 3 of 3

Thread: combobox

  1. #1
    chandu.v is offline Member
    Join Date
    Apr 2008
    Posts
    4
    Rep Power
    0

    Default combobox

    I have a combobox in my frame.In that i have an options like
    Introduction,
    Login,
    Logout.

    I want to give the links to options in drop down list of the combobox using swings.

    Please give me your valuable suggessions
    Last edited by chandu.v; 07-02-2008 at 01:12 PM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,874
    Rep Power
    25

    Default

    Suggestion: Read the doc about combobox, search for examples of how to code it, write some code to use it and then come back here when you have problems.

  3. #3
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    Java Code:
    String[] items = { "Login", "Logout" ... };
    String[] urls = { "urlOne", "urlTwo" ... };
    JComboBox combo = new JComboBox(items);
    combo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int index = ((JComboBox)e.getSource()).getSelectedIndex();
            String urlStr = urls[index];
            // carry on

Similar Threads

  1. ComboBox Fix Width
    By Azndaddy in forum New To Java
    Replies: 2
    Last Post: 05-29-2008, 05:23 AM
  2. Add data to combobox in page load
    By hussainzim in forum JavaServer Pages (JSP) and JSTL
    Replies: 5
    Last Post: 05-15-2008, 01:57 PM
  3. [SOLVED] Adding ComboBox
    By impact in forum New To Java
    Replies: 2
    Last Post: 05-02-2008, 09:43 PM
  4. HashMap and ComboBox
    By banie in forum AWT / Swing
    Replies: 2
    Last Post: 03-26-2008, 12:58 AM
  5. ComboBox with database options
    By Goldy in forum Advanced Java
    Replies: 0
    Last Post: 12-01-2007, 10:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •