Multiple-selection JList

here is my another problem:
how to retrieve the data (tables, columns) from access database to the JList? i already success connected database to the jdbc-odbc bridge...after got the all column names (JList2) from selected table (JList1), i would like to select the certain column name by clicking the ( > , <, >>, << jbutton1, 2, 3, 4 ) to the another JList (JList3) because not all the column is useful to use to analyse. i think i need to use multiple selection JList but i don't know how to start because i am new to java.
thx!

Usually data from a database would be stored in a JTable as it already provide support for multiple rows and columns:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
Also, with JDK1.3 there is some sample code of using a JTable with a database. I'm not sure if the code actually runs, but at least you can look at the source to see the steps involved:
jdk1.3\demo\jfc\TableExample\src>

Similar Messages

  • Problem in multiple selections in a jList

    I have two jLists. Now I have to select some items from one jlist and have to transfer in the other one. But while trying to do it in the runtime I am getting some unexpected runtime errors including "Exception occurred during event dispatching". When I try to transfer only one item it works fine but shows problem in multiple selections. Pleast give your suggestions.

    [_First suggestion_|http://catb.org/~esr/faqs/smart-questions.html]
    [_Second suggestion_|http://mindprod.com/jgloss/sscce.html]
    db

  • Is it possible to diable multiple selections in JTable and JList?

    as the title states, is it possible to disable multiple selections? how to prevent user from using ctrl or shift keys to select multiple rows?

    Use the setSelectionMode(ListSelectionModel.SINGLE_SELECTION ) for your JList / JTable.

  • Multiple selection in JList

    How can I set up a JList that always uses multiple selection. That is, it acts as though the CTRL key is held down when the user selects items.

    Here's an example of multi-selection in a listbox, but using the shift key
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.applet.*;
    public class Multi extends Applet implements KeyListener
         List list = new List(5, true);
         public void init()
              createGUI();
              setSize(300,300);
              this.setVisible(true);
         public void createGUI()
              for (int j = 0; j < 20; j++)
                   list.addItem("TESTING MULTI-SELECTION IN A LIST");
              add (list);
              list.addKeyListener(this);
         public void keyReleased(KeyEvent e)
              int key = e.getKeyCode();
              if (key == KeyEvent.VK_SHIFT)
                   int itm[] = list.getSelectedIndexes();
                   for(int i = itm[0]; i < itm[1]; i++)
                        list.select(i);
         public void keyTyped(KeyEvent e){}
         public void keyPressed(KeyEvent e){}
    }

  • How to use JList's ensureIndexIsVisible and multiple selection using CTRL

    Hello everyone. I am stuck on how to use JList's ensureIndexIsVisible() method and to also allow multiple rows in the list to be selected. Currently, when I begin typing a number stored in the list (i.e. 10001) the focus will go to that row; however, when I press the CTRL key and begin typing another number (i.e. 30001) the focus never goes to the new row. I have a suspicion that I need to cancel out the CTRL key somehow when typing the numbers but also need to keep the knowledge that the CTRL key is pressed to allow for multiple selection. Thanks in advance for your help!
    Regards,
    Will

    Hello everyone. I am stuck on how to use JList's ensureIndexIsVisible() method and to also allow multiple rows in the list to be selected. Currently, when I begin typing a number stored in the list (i.e. 10001) the focus will go to that row; however, when I press the CTRL key and begin typing another number (i.e. 30001) the focus never goes to the new row. I have a suspicion that I need to cancel out the CTRL key somehow when typing the numbers but also need to keep the knowledge that the CTRL key is pressed to allow for multiple selection. Thanks in advance for your help!
    Regards,
    Will

  • Multiple Selection with JCombo Box

    I want to make a multiple - selection JComboBox enables the user to select many items from JComboBox and copy items from one JComboBox to another.How can I do this?

    Hello,
    ComboBoxModel allows only single selection. It's better to use a JList instead because it isnt worthwhile the effort to create another multi-selection model.
    regards,
    Tim

  • Multiple selection in a Combo Box of a JOptionPane.

    Hello,
    Can we have multiple selection of the items in a Combo Box of a JOptionPane?
    An example will be highly appreciated.
    Thanks.

    Use a JList for multiple selection.

  • List with multiple selection

    Hello;
    I seek a code to implement a list with multiple selection for a browser Web (HTML is imited).
    I have a list containing of the years, the user can select one or several years and I created dynamically a array : for each year a column.
    Thank you;

    Look at JList.
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JList.html
    � {�                                                                                                                                                                           

  • Multiple selection in common dialog box

    Hi friends
    I have to select a multiple file from specified directory and disply it in image file, when i m using get_file_name function it allows me to select single file and read image file one by one but i want select not all some file from directory and whatsoever file is selected it will display it in image file.
    please suggest me.........

    Use a JList for multiple selection.

  • Select JList item on Mouse over Event

    Hoi All,
    I am trying to find a way to select the items in a JList when the mouse is moved over the item.
    Any help is appreciated
    Kind Regrads ,
    Werns

    Hey J�rg,
    I solvd the problem by using the following method:
      public void dragOver(DropTargetDragEvent dtde) {
                jListLocalLibrary.setSelectedIndex(jListLocalLibrary.locationToIndex(dtde.getLocation()));
            }What i'm doing is creating a digital library so the owner of a book kan move a book between shelves so you have one JList that shows books of a shelf and a nother JList that shows the available shelves the JList is not enabled to accomodate multiple selection thus the derection from which the JList is approcahed does not matter.
    If you need more info just drop me a reply and i'll be happy to share.

  • Is it possible to paste multiple selections from excel?

    How do you detect in Java whether a multiple selection in excel has been copied to the clipboard.
    For instance: I have an excel spreadsheet - 3 rows x 3 columns. I highlight the first 3 rows in column 1 and the first 3 rows in column 3 then I copy this to the clipboard (ctrl-c). If I now go to a text editor and paste this then the data from all 3 columns, not the expected 2 columns, appears.
    Likewise, in Java I have tried using the clipboard object looking at all the different data flavours to find a way of detecting that only data from the 1st and the 3rd columns were copied. But I can't find a way.
    This is most likely a microsoft issue in that they never make this information available from the clipboard.
    Can anyone shed any light on this one?

    Use the setSelectionMode(ListSelectionModel.SINGLE_SELECTION ) for your JList / JTable.

  • Managing multiple selections using listModel......

    Hey,
    Im a newbie to java can anyone give me a pointer or two as to how I would go about removing multiple selections from a JList using listModel??
    Any help would be great.
    -Ben

    Why not try using the removeSelectionInterval(int,int) method of the JList itself? It should be fairly obvious as to how to proceed with this (i.e. stepping through the list element at a time, deselecting as necessary).
    I'm watching this topic if you need further help!

  • Dropdowns with multiple selection functionality

    Hi Gurus,
    How can I achieve dropdowns with range and multiple selection functionality in WDA?
    Your help will be highly appreciated.
    Regards,
    David.

    Look at JList.
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JList.html
    � {�                                                                                                                                                                           

  • Multiple Select in same Query

    I'm building a report based on a single table in APEX. The report requires the following.
    select user, project, count(start date ), project, count(end date) where date between 01-jan-07 01-feb-07
    (simplified to show the idea)
    basicaly a count of projects that started between two dates and the ones that ended between the same two dates relating to the user.
    I have writen the selects to do both parts and they work BUT is it posible to glue them together in a single statement?
    I tried to searching the forum on "multiple selects" but never realy got anything close.
    Is it possible to do this type of select? If so does it have a special name (so I can try a search on that name)
    Thanks
    Bjorn

    First of all, '11-MAY-06' and '19-MAY-06' are not dates, they are strings. This has some important disadvantages:
    1) Oracle has to implicitly convert them to a date, when they are being compared to a date column
    2) Your application will be NLS (National Language Support) dependent, so they might break when you change a setting
    3) When compared to a varchar2 or other string column, the comparison will give incorrect results. For example: 12-MAY-06 will be between 06-JAN-06 and 18-JAN-06
    Bottom line: convert those dates to real dates using the to_date function, or the date 'yyyy-mm-dd' variant.
    Back to your question, apparently you don't want to count the number of occurences of CON_ACTUAL_START and CON_SIGN_OFF, but you only want to count them when this date is between the two boundary values. So use the following:
    select mli_clo
         , count(case when con_actual_start between date '2006-05-11' and date '2006-05-19' then 1 end)
         , count(case when con_sign_off between date '2006-05-11' and date '2006-05-19' then 1 end)
    ...Regards,
    Rob.

  • How to get multiple selections from jsp page in my servlet

    Hello Everyone,
    I've a list that allows users to make multiple selections.
    <select name=location multiple="multiple">
        <option>
             All
        </option>
        <option>
             Hyd
        </option>
        <option>
             Dub
        </option>
        <option>
             Mtv
        </option>
      </select>I want to get the selections made by user in jsp page from my servlet, selections can be multiple too.
    ArrayList locList = new ArrayList();
    locList = request.getParameter("location");when I do so, I get compilation error as the request returns string type. How do I then get multiple selections made by the user.
    Please let me know.

    For those kind of basic questions it would help a lot if you just gently consult the javadocs and tutorials.
    HttpServletRequest API: [http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpServletRequest.html]
    Java EE tutorial part II: [http://java.sun.com/javaee/5/docs/tutorial/doc/]
    Coreservlet tutorials: [http://courses.coreservlets.com/Course-Materials/]

Maybe you are looking for

  • How to find out who your administrator is and why I can't view certain things even on this web sight business account is what I have

    How do I find out who my administrator is and why I can't view certain things and get error 401 says i am an unauthorized user It is a small business which doesn't make sense why I shouldn't be able to access certain pages  on the Internet I believe

  • 6230i memory card problem

    I've recently resurrected my old 6230i and begun using it again. However in doing so I've come across a wee problem..... The big memory card that was supplied with the phone and hidden beneath the battery is only 32Mb - hardly sufficient to use the M

  • Importing a journal voucher with GL Codes and BP Codes

    Hi Experts, I'm trying to get a DTW import for Journal Vouchers working on 8.8 PL05. I have a journal voucher template with GL Codes and BP Codes that I need to import as this is part of some integration. If I leave out the BP Codes it works fine but

  • How to add a field that is not part of existing page attributes

    Hi Experts, Can someone give step by step procedure for adding a field that is not part of IC web view page attributes. I mean the field that I want to add is in BOL entity BTSaleset which is linked to BTAdminH through BTHeadersaleset relation. I hav

  • Some pulldown menus are scrambled

    When you fill in a form on a website there are often drop down menus. Some of these have become scrambled (i'll add screenshots). For instance on gog.com when i have to select the expiry year of my visa card the list in the dropdown box is unreadable