Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Trying to remove any item i've added to the copyLst

  Asked By: Marty    Date: Jul 05    Category: Java    Views: 7112
  

This application works as well but i am now trying to remove any item
i've added to the copyLst but i am stuck.... This is also the part of
the code I want to associate with post number 10093. If anyone
believe they can help me for any of these two codes please do so !!


import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class ClassList extends Applet implements ActionListener
{
private List classLst, copyLst;
private Button copy, remove;
private String classNames[] =
{
"COEN 311", "COEN 312", "COEN 243",
"COEN 417", "ELEC 311"
};

public void init()
{
classLst = new List(5, false);

for( int i = 0; i < classNames.length; i++)
classLst.add( classNames[i] );

add(classLst);

copy = new Button("Copy >>>");
copy.addActionListener(this);
add(copy);

remove = new Button("Remove <<<");
remove.addActionListener(this);
add(remove);

copyLst = new List(5, false);
add(copyLst);
}

public void actionPerformed( ActionEvent e )
{
if( e.getSource() == copy )
{
String copyCls[];

copyCls = classLst.getSelectedItems();

for( int i = 0; i < copyCls.length; i++)
copyLst.add(copyCls[i]);
}
else if( e.getSource() == remove )
{
String removeCls[];

removeCls = copyLst.getSelectedItems();

for( int i = 0; i < removeCls.length; i++)
removeCls[i].setVisible(false);
}

}
}

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Trying to remove any item i've added to the copyLst Or get search suggestion and latest updates.




Tagged: