Moving stuff from one JList to an other

Hi,
I'm trying to develop a JPanel with two JLists and two arrow JButtons to be able to move (!) stuff from the left JList to the Right and backwards. Both JLists have a ListCellRenderer that extend JLabel.
Managed to do a 'copy' of selected values to the other JList,
eg.
public void addKeyWords(java.awt.event.ActionEvent actionEvent,javax.swing.JList allKeyWords,javax.swing.JList chosenKeyWords) {
java.util.List chosenValues = java.util.Arrays.asList(chosenKeyWords.getSelectedValues());
java.util.List selectedValues = java.util.Arrays.asList(allKeyWords.getSelectedValues());
java.util.Set set = new java.util.HashSet();
set.addAll(selectedValues);
javax.swing.JList l = new javax.swing.JList(set.toArray());
getChosenKeyWordsList().setModel(l.getModel());
return;
but can't figure out how to get stuff to disappear in the first JList when it is moved to the other JList nore how to enable the user to 'add' elements one at a time.
Enyone?

hi.
what i do when i want to remove from the right side list:
//get an array of indexes that needs to be removed.
elements[] removedItems = getStrings(rightListData, selected);
//copy all elements that do NOT need to be removed
rightListData = utils.copyArrayWithoutIndex(rightData, selected);
rightList.setListData(rightListData);
same goes for left side.
basically, i remove all selected elements from the array of rows, and re-set the list data model.
HTH.

Similar Messages

  • How can I moving photos from one roll to an other

    I tried to drag and drop photos from one roll to an other. If the roll has a lot of photos (e.g. 250) I can not scroll down to a roll below. iPhotos does not automatically scroll down when I try to drag them down.
    How can I scroll or move these down?
    thanks for your input
    Baguette

    Drag and drop will work, but you have to drag to the roll title. It will turn blue when you can drop the photos. It should scroll when you move to the top or bottom of the window, but sometimes it gets going really fast and is hard to stop where you want it.
    An easy way is to close the rolls and make everything as small as possible so the the source and destination rolls are all in the window at the same time. Of course if you have a really big library this might work.

  • Moving photos from one album to the other

    I have the Iphone 5 using IOS 7.0.4, I want to move photos from one album to another. How can that be done? I have tried everything on the web and nothing works.

    user645399 wrote:
    Which one among this I should be using, I understand that I need PACKAGE SPEC to get the Package's Spec but to get the body, should I be just using the BODY clause? Whats PACKAGE is all about?
    SELECT dbms_metadata.get_ddl('PACKAGE','package_1')
    FROM dual;
    SELECT dbms_metadata.get_ddl('PACKAGE_SPEC','package_1')
    FROM dual;
    SELECT dbms_metadata.get_ddl('PACKAGE_BODY','package_1')
    FROM dual;
    By using just PACKAGE type, you can get both spec and body
    Check the following link to get the list of all object types that are used in DBMS_METADATA.GET_DDL :
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#BGBIEDIA
    Kamran Agayev A.
    Oracle ACE
    My Oracle Video Tutorials - http://kamranagayev.wordpress.com/oracle-video-tutorials/

  • Moving objects from one infoarea to the other infoarea.

    Hi all,
    I have created few objects like ODS , cubes and multiprovider under suppose InfoArea A.
    But now I have to move all these to InfoArea B.
    When I am trying to drag and drop these objects from InfoArea A to InfoArea B it is giving following message.
    Drag  Drop is switched off - switch on inRSADMIN/RSADMINSV
    when I am going to Tcode RSADMIN it is giving following message.
    BW User ALE          ALEREMOTE
    Debugging User
    BEx order number     DB0K910429
    Releasest. hier
    Monitor initial
    Last IDoc no.        56
    Last IS-Nr.          0
    XPRA executed
    Lock Mangr Logs
    MD: Sing. Rec. Inst
    I am not aware of these options. So please provide some infromation to go ahead.
    I am wiating for your reply.
    Thanks,
    Uday.

    Hi,
    You have to maintain settings on RSADMINSV table.
    1. Goto SM30 transaction.
    2. Pass the table RSADMINSV and goto change mode.
    3. Uncheck the Drag & Drop Off option.
    4. Save and exit.
    Check out the SAP note : 642989.
    Regards,
    Vivek

  • " Moving records from one subtype to some other subtype "

    Hi,
    I have some records in IT0105( subtype = 9028 ) and i want to move these records in IT0105 ( subtype = 0001 ). How to perform this.Plz anyone help me in this regard.

    Hi,
    Use the FM 'RH_PNNNN_MAINTAIN' to update the Infotype OR check this FM HRXSS_PER_MODIFY_P0105_US
    CALL FUNCTION 'RH_PNNNN_MAINTAIN'
        EXPORTING
          act_fcode             = 'AEND;
          act_plvar             = p_plvar
          act_otype             = p_otype
          act_objid             = p_objid
          act_infty             = p_infty
          act_subty             = p_subty
          act_pnnnn             = p_pnnnn
          act_gdate             = sy-datum
          suppress_dialog       = '2'
          act_vtask             = 'B' "B
          act_commit_flg        = l_commit_flg
          clear_buffer_plog_tab = ''
        IMPORTING
          act_mess_info         = l_hrrhad_msg
        EXCEPTIONS
          infty_not_valid       = 1
          no_plvar              = 2
          object_not_defined    = 3
          otype_not_valid       = 4
          no_authority          = 5
          action_rejected       = 6
          no_gdate              = 7
          fcode_not_supported   = 8
          OTHERS                = 9.
    Edited by: Avinash Kodarapu on Feb 16, 2009 10:59 AM

  • Moving pictures from one iphoto library to another

    Hello all, I have a simple question.
    I have all of my pictures on one computer in an iphoto library. I have a new imac (it's quite lovely) and I would like to move all my pictures to that mac. Which folders do I need to copy and move to my new computer? I would like to keep albums, etcetera.
    Normally I would just transfer all my stuff from one mac to the other and voila, it's done, but I have done that so many times that there is a problem with my User info and it has followed me from several computers now, so I am starting fresh. I would like to keep my pictures however. Which also leads me to my next question. Could someone suggest a good way to archive my 40 some-odd gigs of pictures?
    thanks in advance.

    Re: Copying the Library - Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Include the option to check and repair permissions in the Library.
    Re: Archiving: There is no permanent storage solution for digital material. Yes DVDs do offer longevity but even the most expensive are prone to problems eventually. The cheaper ones sooner! To my mind the best option is to have a variety of solutions, on- and off-site. Optical media, Hard Disks, Online Storage solutions should all be used - and more importantly - checked regularly.
    Regards
    TD

  • Steps required while moving employees from one organisational

    Can any one explain and write down steps required while moving employees from one organisational unit to other organisational unit.
    regards

    Hi ganesh,
    Firstly create the new position for the employee if it is not already existing.
    Then goto SPRO : Personnel Man. -> Pers. Adm-> Customizing procedures -> Actions -> Define infogroups -> infogroup.
    Only Copy 0001 is enough.
    Then Setup personnel actions with this infogroup.
    Then go to PA40 and execute this action for that specific employee.
    You will only need to change the position assignment, org unit, job, vs all come from position info.
    Regards,
    Dilek
    Edited by: Dilek Ersoz on Oct 14, 2008 9:41 AM

  • How to  move items from one JList to other

    Can u pls help me out to implement this(I m using Netbeans 5.5):
    I want to move items from one JList to other thru a ADD button placed between JLists, I am able to add element on Right side JList but as soon as compiler encounter removeElementAt() it throws Array Index Out of Bound Exception
    and if I use
    removeElement() it removes all items from left side JList and returns value false.
    Pls have a look at this code:
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
    // TODO add your handling code here:
    Object selItem = jList1.getSelectedValue();
    int selIndex = jList1.getSelectedIndex();
    DefaultListModel model = new DefaultListModel();
    jList2.setModel(model);
    model.addElement(selItem);
    DefaultListModel modelr = new DefaultListModel();
    jList1.setModel(modelr);
    flag = modelr.removeElement(selItem);
    //modelr.removeElementAt(selIndex);
    System.out.println(flag);
    }

    hi Rodney_McKay,
    Thanks for valuable time but my problem is as it is, pls have a look what I have done and what more can b done in this direction.
    Here is the code:
    import javax.swing.DefaultListModel;
    import javax.swing.JList;
    public class twoList extends javax.swing.JFrame {
    /** Creates new form twoList */
    public twoList() {
    initComponents();
    //The code shown below is automatically generated and we can�t edit this code
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    jList1 = new javax.swing.JList();
    jButton1 = new javax.swing.JButton();
    jScrollPane2 = new javax.swing.JScrollPane();
    jList2 = new javax.swing.JList();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    jList1.setModel(new javax.swing.AbstractListModel() {
    String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
    public int getSize() { return strings.length; }
    public Object getElementAt(int i) { return strings[i]; }
    jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
    public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
    jList1ValueChanged(evt);
    jScrollPane1.setViewportView(jList1);
    jButton1.setText("ADD>>");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    jScrollPane2.setViewportView(jList2);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(31, 31, 31)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jButton1)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addContainerGap(78, Short.MAX_VALUE))
    layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jScrollPane1, jScrollPane2});
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(62, 62, 62)
    .addComponent(jButton1))
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
    .addContainerGap(159, Short.MAX_VALUE))
    layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jScrollPane1, jScrollPane2});
    pack();
    }// </editor-fold>
    //automatic code ends here
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
    // TODO add your handling code here:
            jList1 = new JList(new DefaultListModel());
            jList2 = new JList(new DefaultListModel());
             Object selItem = jList1.getSelectedValue();
             System.out.println(selItem);
            ((DefaultListModel) jList1.getModel()).removeElement(selItem);
            ((DefaultListModel) jList2.getModel()).addElement(selItem);
    //Now trying with this code it is neither adding or removing and the value �null� is coming in �selItem� .It may be bcoz JList and Jlist are already instantiated in automatic code. So, I tried this:
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
    // TODO add your handling code here:
             Object selItem = jList1.getSelectedValue();
             System.out.println(selItem);
            ((DefaultListModel) jList1.getModel()).removeElement(selItem);
            ((DefaultListModel) jList2.getModel()).addElement(selItem);
    //Now with this as soon as I click on �jButton1�, it is throwing this error:
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: twoList$1 cannot be cast to javax.swing.DefaultListModel
            at twoList.jButton1ActionPerformed(twoList.java:105)
            at twoList.access$100(twoList.java:13)
            at twoList$3.actionPerformed(twoList.java:50)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
            at java.awt.Component.processMouseEvent(Component.java:6038)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
            at java.awt.Component.processEvent(Component.java:5803)
            at java.awt.Container.processEvent(Container.java:2058)
            at java.awt.Component.dispatchEventImpl(Component.java:4410)
            at java.awt.Container.dispatchEventImpl(Container.java:2116)
            at java.awt.Component.dispatchEvent(Component.java:4240)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
            at java.awt.Container.dispatchEventImpl(Container.java:2102)
            at java.awt.Window.dispatchEventImpl(Window.java:2429)
            at java.awt.Component.dispatchEvent(Component.java:4240)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

  • Moving file from one location to other in shell script

    HI All,
    I am facing one problem in moving file from one location to another location please help me out.
    My code is as below :
    mv ${file}.log ${DATA_XXX}/../archive/${file}.log_`date +"%m%d%y%H%M%S"`
    mv ${file} ${DATA_XXX}/../archive/'abc'.`date +"%m%d%y%H%M%S"`
    where file =test1 and DATA_XXX= "k01/aa/in"
    please help me on this
    Thanks

    Please describe the problem. Perhaps you are missing the / i.e. /${DATA_XXX}

  • TROUBLE MOVING CONTACTS FROM ONE GROUP , TO OTHER (APPLE ADDRESS BOOK) WHEN I TRY TO DRAG IT WON'T STAY . WHERE SHOULD I BE , AND HOW DO I DRAG ???? AND RELEASE

    TROUBLE MOVING CONTACTS FROM ONE GROUP , , TO OTHER (APPLE ADDRESS BOOK) WHEN I TRY TO DRAG IT WON'T STAY . WHERE SHOULD I BE , AND HOW DO I DRAG ???? AND RELEASE   AB

    I have many different mailaccounts and different groups of contacts on my ipad and iphone. Sometimes i made the mistake when i create a new account linking it with the standard account. How it is possible to move one account to an other group?

  • How can I send stuff from one iPhone to another via Bluetooth?

    How can I send stuff from one iPhone to another via Bluetooth?

    There are some apps that will let you send photos from one iOS device to another over BT.

  • How can I keep all of my apps and stuff from one ID and move them to another ID without having to buy them all over again?

    Me and my mom share an account and I bought all my apps and stuff on their. so I made my own account so that it would just have my stuff and it would charge to my credit card. So I was wondering how you can sink all the apps and stuff from one ID to another or link the accounts so that I don't have to repurchase everything.

    You can render the ebook on an instructional application called Zankura. Not only can you control the screen scrolling, but all the students can freely annotate with their stylus. www.zankura.com.

  • How can I script moving paths from one file to another?

    Hello. I have 1 image with various color correction layers. The other is the exact same size but only contains paths. How can I script moving paths from one file to another? Thanks, in advance, for any help you can offer. Thanks!

    Thanks! This one actually worked for me. Thanks for your help.
    http://forums.adobe.com/message/3305389#3305389

  • Moving images from one library to another; or how to have 2 libraries open at the same time in Aperture 2

    This may be something easy but for some reason I am having a hard time figuring this out. Basically this is the situation: I have a library on my MBP hd that I import pictures to when I am not hooked up to my external hd for the time being. The main library is of course on the external 2tb drive. How do I have 2 libraries open so that I can essentially drag and drop the pictures from one library to another? It would basically be like moving files from one project to another. Thanks for any help!

    Always keep a backup of your original images, before you delete them. I make a backup right form the card, before I even import them to Aperture.
    How are your images stored right now? Are the referenced or managed? On your big volume I'd consolidate the newly imported images, to be sure they are really inside the Aperture library before I delete any images outside the library.
    but they have the little yellow triangle caution symbol on them and I can see them but not really edit them
    That is a very typical problem, when you imported your images as referenced images then somehow delete or move the original master image files, that are stored outside the Aperture library.
    Do you still have the original masters of the images with the yellow triangle that you cannot edit? In Aperture 3 you can point Aperture to the location of the master image file "File >Locate referenced image" - probably Aperture 2 has a similar command to let you reconnect your masters, if you still have them. Look into the manual.

  • I have recently transferred data from my old Mac to my new one. The result was good, but I have 2 users now, whose data I want to merge into 1 single user, so to avoid having to switch from one user to the other to view and use certain files. How to do it

    I have recently transferred data from my old Mac to my new one. The result was good, but I have 2 users now, whose data I want to merge into 1 single user, so to avoid having to switch from one user to the other to view and use certain files. How to do it?

    Here's an easy way:
    Pick the user that you want to eliminate (making sure that the remaining user has administrator privileges) and move all of the data that you want to keep into the Shared folder. Reboot or log out and login to the user you want to keep. Copy all the data from the Shared folder into your account - placing it neatly in folders (Documents, Music, Movies, etc.).
    Once the data is moved, log into the account you want to delete just once more to make certain that you've grabbed all the data you want to keep. Log out and log back into your admin account and go to System Preferences>Users & Groups and delete the 'old' user.
    That should do it.
    Clinton

Maybe you are looking for

  • How can I execute a button-process and trigger a branch??

    I create a button (ADD), a process (seq:30 condition:ADD button) and a branch (seq:50 condition:ADD button point: on commit:after process). I wanna execute this process by click button, then trigger this branch to other page. but now, only process ha

  • Changing font colors within an output string

    Hi, I'm not sure if this can even be done, if so I have no clue of what to research to try it. Maybe someone knows or could shed some light on this. I have numerious pages that are using the following code to set page titles: <cfset pagetitle = "ACCO

  • Additional tab in sales order-incompletion log

    Hi We have added additional tab in sales order at item level... But when we try to put the some fields which are available in the additional tab into incompletion log,we are not able to select the respective screen name... How to add that additional

  • How to set button validation false

    Hi, Actually I am working on a seeded page.In that page there is one button next,and whenever i click that button some validation is happening i.e some warning message is coming through VORow impl.I just want to remove that validationt through extend

  • V20z service processor

    Before I call Sun, I thought I'd ask here: I have a brand new SunFire v20z that I am trying to manage remotely. I had no problem getting the service processor set up and connecting to it, and I was able to access it for several days. It worked fine.